Search in sources :

Example 1 with Secures

use of org.apache.deltaspike.security.api.authorization.Secures in project deltaspike by apache.

the class SecuredAnnotationAuthorizer method doSecuredCheck.

@Secures
@Secured({})
@SuppressWarnings("UnusedDeclaration")
public boolean doSecuredCheck(InvocationContext invocationContext) throws Exception {
    List<Class<? extends AccessDecisionVoter>> voterClasses = new ArrayList<Class<? extends AccessDecisionVoter>>();
    List<Annotation> annotatedTypeMetadata = extractMetadata(invocationContext);
    for (Annotation annotation : annotatedTypeMetadata) {
        if (Secured.class.isAssignableFrom(annotation.annotationType())) {
            voterClasses.addAll(Arrays.asList(((Secured) annotation).value()));
        } else if (voterContext instanceof EditableAccessDecisionVoterContext) {
            ((EditableAccessDecisionVoterContext) voterContext).addMetaData(annotation.annotationType().getName(), annotation);
        }
    }
    invokeVoters(invocationContext, voterClasses);
    // X TODO check the use-cases for it
    return true;
}
Also used : Secured(org.apache.deltaspike.security.api.authorization.Secured) AccessDecisionVoter(org.apache.deltaspike.security.api.authorization.AccessDecisionVoter) Annotation(java.lang.annotation.Annotation) EditableAccessDecisionVoterContext(org.apache.deltaspike.security.spi.authorization.EditableAccessDecisionVoterContext) Secures(org.apache.deltaspike.security.api.authorization.Secures) Secured(org.apache.deltaspike.security.api.authorization.Secured)

Aggregations

Annotation (java.lang.annotation.Annotation)1 AccessDecisionVoter (org.apache.deltaspike.security.api.authorization.AccessDecisionVoter)1 Secured (org.apache.deltaspike.security.api.authorization.Secured)1 Secures (org.apache.deltaspike.security.api.authorization.Secures)1 EditableAccessDecisionVoterContext (org.apache.deltaspike.security.spi.authorization.EditableAccessDecisionVoterContext)1