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

org.apache.shiro.biz.authz.aop.RolesAllowedAnnotationHandler Maven / Gradle / Ivy

There is a newer version: 2.0.0.RELEASE
Show newest version
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