Class UserAnnotationHandler


  • public class UserAnnotationHandler
    extends AuthorizingAnnotationHandler
    Checks to see if a @RequiresUser annotation is declared, and if so, ensures the calling Subject is either authenticated or remembered via remember me services before allowing access.

    This annotation essentially ensures that subject.getPrincipal() != null.

    Since:
    0.9.0
    • Constructor Detail

      • UserAnnotationHandler

        public UserAnnotationHandler()
        Default no-argument constructor that ensures this handler looks for RequiresUser annotations.
    • Method Detail

      • assertAuthorized

        public void assertAuthorized(Annotation a)
                              throws AuthorizationException
        Ensures that the calling Subject is a user, that is, they are either authenticated or remembered via remember me services before allowing access, and if not, throws an AuthorizingException indicating access is not allowed.
        Specified by:
        assertAuthorized in class AuthorizingAnnotationHandler
        Parameters:
        a - the RequiresUser annotation to check
        Throws:
        AuthorizationException - if the calling Subject is not authenticated or remembered via rememberMe services.