protected void checkSubjectRolesAndPermissions ( final Subject currentUser ) throws FailedLoginException { if ( this . requiredRoles != null ) { for ( val role : this . requiredRoles ) { if ( ! currentUser . hasRole ( role ) ) { throw new FailedLoginException ( "Required role " + role + " does not exist" ) ; } } } if ( this . requiredPermissions != null ) { for ( val perm : this . requiredPermissions ) { if ( ! currentUser . isPermitted ( perm ) ) { throw new FailedLoginException ( "Required permission " + perm + " cannot be located" ) ; } } } }
Check subject roles and permissions .