use of fish.payara.cdi.auth.roles.CallerAccessException in project Payara by payara.
the class RolesPermittedInterceptor method method.
/**
* Method invoked whenever a method annotated with @Roles, or a method
* within a class annotated with @Roles is called.
*
* @param invocationContext Context provided by Weld.
* @return Proceed to next interceptor in chain.
* @throws java.lang.Exception
* @throws fish.payara.cdi.auth.roles.CallerAccessException if access is not permitted
*/
@AroundInvoke
public Object method(InvocationContext invocationContext) throws Exception {
RolesPermitted roles = getRolesPermitted(invocationContext);
boolean isAccessPermitted = checkAccessPermitted(roles, invocationContext);
if (!isAccessPermitted) {
throw new CallerAccessException("Caller was not permitted access to a protected resource");
}
return invocationContext.proceed();
}
use of fish.payara.cdi.auth.roles.CallerAccessException in project Payara by payara.
the class RolesCDIInterceptor method method.
/**
* Method invoked whenever a method annotated with @Roles, or a method within a class annotated with @Roles is
* called.
*
* @param invocationContext Context provided by Weld.
* @return Proceed to next interceptor in chain.
*/
@AroundInvoke
public Object method(InvocationContext invocationContext) throws Exception {
RolesPermitted roles = getRolesPermitted(invocationContext);
boolean isAccessPermitted = checkAccessPermitted(roles);
if (!isAccessPermitted) {
throw new CallerAccessException("Caller was not permitted access to a protected resource");
}
return invocationContext.proceed();
}
Aggregations