org.apache.shiro.biz.authz.aop.RolesAllowedAnnotationHandler Maven / Gradle / Ivy
package org.apache.shiro.biz.authz.aop;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.authz.aop.AuthorizingAnnotationHandler;
import org.apache.shiro.biz.authz.annotation.RolesAllowed;
public class RolesAllowedAnnotationHandler extends AuthorizingAnnotationHandler {
public RolesAllowedAnnotationHandler() {
super(RolesAllowed.class);
}
@Override
public void assertAuthorized(Annotation a) throws AuthorizationException {
RolesAllowed rrAnnotation = (RolesAllowed) a;
String[] roles = rrAnnotation.value();
getSubject().checkRoles(Arrays.asList(roles));
return;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy