All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.security.runtime.interceptor.RolesAllowedInterceptor Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package io.quarkus.security.runtime.interceptor;

import jakarta.annotation.Priority;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject;
import jakarta.interceptor.AroundInvoke;
import jakarta.interceptor.Interceptor;
import jakarta.interceptor.InvocationContext;

import io.quarkus.security.spi.runtime.AuthorizationController;

/**
 * @author Michal Szynkiewicz, [email protected]
 */
@Interceptor
@RolesAllowed("")
@Priority(Interceptor.Priority.LIBRARY_BEFORE)
public class RolesAllowedInterceptor {

    @Inject
    SecurityHandler handler;

    @Inject
    AuthorizationController controller;

    @AroundInvoke
    public Object intercept(InvocationContext ic) throws Exception {
        if (controller.isAuthorizationEnabled()) {
            return handler.handle(ic);
        } else {
            return ic.proceed();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy