@Test public void should_ReturnMethodAsSecurityTarget_When_BothClassAndMethodHaveSecurityAnnotations() throws Exception { @AnonymousAllowed class Test { @AnonymousAllowed public void test() { } } Method securityMethod = Test.class.getMethod("test"); assertEquals(securityMethod, checker.getSecurityTarget(securityMethod)); }
public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); }
VaadinConnectAccessChecker { public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); } }
VaadinConnectAccessChecker { public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); }  }
VaadinConnectAccessChecker { public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); }  String check(Method method); AnnotatedElement getSecurityTarget(Method method); }
VaadinConnectAccessChecker { public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); }  String check(Method method); AnnotatedElement getSecurityTarget(Method method);  }