Search in sources :

Example 1 with PermissionAnnotationMethodInterceptor

use of org.apache.shiro.authz.aop.PermissionAnnotationMethodInterceptor in project perry by ca-cwds.

the class TestModule method configure.

@Override
protected void configure() {
    bind(TestService.class).to(TestServiceImpl.class);
    install(new SecurityModule(null).addAuthorizer("case:read", CaseAuthorizer.class).addStaticAuthorizer(TestStaticAuthorizer.class));
    bindInterceptor(Matchers.any(), Matchers.any(), new MethodInterceptor() {

        PermissionAnnotationMethodInterceptor permissionAnnotationMethodInterceptor = new PermissionAnnotationMethodInterceptor();

        @Override
        public Object invoke(MethodInvocation invocation) throws Throwable {
            return permissionAnnotationMethodInterceptor.invoke(new org.apache.shiro.aop.MethodInvocation() {

                @Override
                public Object proceed() throws Throwable {
                    return invocation.proceed();
                }

                @Override
                public Method getMethod() {
                    return invocation.getMethod();
                }

                @Override
                public Object[] getArguments() {
                    return invocation.getArguments();
                }

                @Override
                public Object getThis() {
                    return invocation.getThis();
                }
            });
        }
    });
}
Also used : MethodInterceptor(org.aopalliance.intercept.MethodInterceptor) PermissionAnnotationMethodInterceptor(org.apache.shiro.authz.aop.PermissionAnnotationMethodInterceptor) PermissionAnnotationMethodInterceptor(org.apache.shiro.authz.aop.PermissionAnnotationMethodInterceptor) TestService(gov.ca.cwds.testapp.service.TestService) TestStaticAuthorizer(gov.ca.cwds.security.authorizer.TestStaticAuthorizer) MethodInvocation(org.aopalliance.intercept.MethodInvocation) SecurityModule(gov.ca.cwds.security.module.SecurityModule)

Aggregations

TestStaticAuthorizer (gov.ca.cwds.security.authorizer.TestStaticAuthorizer)1 SecurityModule (gov.ca.cwds.security.module.SecurityModule)1 TestService (gov.ca.cwds.testapp.service.TestService)1 MethodInterceptor (org.aopalliance.intercept.MethodInterceptor)1 MethodInvocation (org.aopalliance.intercept.MethodInvocation)1 PermissionAnnotationMethodInterceptor (org.apache.shiro.authz.aop.PermissionAnnotationMethodInterceptor)1