@Test public void matches() throws NoSuchMethodException { assertTrue( "the method is annotated, should match", new AuthorizationAttributeSourceAdvisor().matches( Secured.class.getDeclaredMethod("secureMethod"), Secured.class )); assertFalse( "the method is not annotated, should not match", new AuthorizationAttributeSourceAdvisor().matches( Secured.class.getDeclaredMethod("unsecuredMethod"), Secured.class )); assertTrue( "the method declaration is annotated in the interface, should match", new AuthorizationAttributeSourceAdvisor().matches( ServiceInterface.class.getDeclaredMethod("secureMethod"), ServiceImpl.class )); assertFalse( "not annotated method, should not match", new AuthorizationAttributeSourceAdvisor().matches( ServiceInterface.class.getDeclaredMethod("unsecuredMethod"), ServiceImpl.class )); assertTrue( "the method declaration is in the interface with type-annotation, should match", new AuthorizationAttributeSourceAdvisor().matches( SafeServiceInterface.class.getDeclaredMethod("someMethod"), SafeServiceInterface.class )); assertTrue( "the method declaration is in the interface with type-annotation, should match", new AuthorizationAttributeSourceAdvisor().matches( SafeServiceImpl.class.getDeclaredMethod("someMethod"), SafeServiceImpl.class )); }
public boolean matches(Method method, Class targetClass) { Method m = method; if ( isAuthzAnnotationPresent(m) ) { return true; } if ( targetClass != null) { try { m = targetClass.getMethod(m.getName(), m.getParameterTypes()); return isAuthzAnnotationPresent(m) || isAuthzAnnotationPresent(targetClass); } catch (NoSuchMethodException ignored) { } } return false; }
AuthorizationAttributeSourceAdvisor extends StaticMethodMatcherPointcutAdvisor { public boolean matches(Method method, Class targetClass) { Method m = method; if ( isAuthzAnnotationPresent(m) ) { return true; } if ( targetClass != null) { try { m = targetClass.getMethod(m.getName(), m.getParameterTypes()); return isAuthzAnnotationPresent(m) || isAuthzAnnotationPresent(targetClass); } catch (NoSuchMethodException ignored) { } } return false; } }
AuthorizationAttributeSourceAdvisor extends StaticMethodMatcherPointcutAdvisor { public boolean matches(Method method, Class targetClass) { Method m = method; if ( isAuthzAnnotationPresent(m) ) { return true; } if ( targetClass != null) { try { m = targetClass.getMethod(m.getName(), m.getParameterTypes()); return isAuthzAnnotationPresent(m) || isAuthzAnnotationPresent(targetClass); } catch (NoSuchMethodException ignored) { } } return false; } AuthorizationAttributeSourceAdvisor(); }
AuthorizationAttributeSourceAdvisor extends StaticMethodMatcherPointcutAdvisor { public boolean matches(Method method, Class targetClass) { Method m = method; if ( isAuthzAnnotationPresent(m) ) { return true; } if ( targetClass != null) { try { m = targetClass.getMethod(m.getName(), m.getParameterTypes()); return isAuthzAnnotationPresent(m) || isAuthzAnnotationPresent(targetClass); } catch (NoSuchMethodException ignored) { } } return false; } AuthorizationAttributeSourceAdvisor(); SecurityManager getSecurityManager(); void setSecurityManager(org.apache.shiro.mgt.SecurityManager securityManager); boolean matches(Method method, Class targetClass); }
AuthorizationAttributeSourceAdvisor extends StaticMethodMatcherPointcutAdvisor { public boolean matches(Method method, Class targetClass) { Method m = method; if ( isAuthzAnnotationPresent(m) ) { return true; } if ( targetClass != null) { try { m = targetClass.getMethod(m.getName(), m.getParameterTypes()); return isAuthzAnnotationPresent(m) || isAuthzAnnotationPresent(targetClass); } catch (NoSuchMethodException ignored) { } } return false; } AuthorizationAttributeSourceAdvisor(); SecurityManager getSecurityManager(); void setSecurityManager(org.apache.shiro.mgt.SecurityManager securityManager); boolean matches(Method method, Class targetClass);  }