Class DefaultSecurityService

    • Constructor Detail

      • DefaultSecurityService

        public DefaultSecurityService​(RolesFinder rolesFinder)
        Parameters:
        rolesFinder - Roles Parser
    • Method Detail

      • username

        public java.util.Optional<java.lang.String> username()
        Get the username of the current user.
        Specified by:
        username in interface SecurityService
        Returns:
        the username of the current user
      • isAuthenticated

        public boolean isAuthenticated()
        Check if a user is authenticated.
        Specified by:
        isAuthenticated in interface SecurityService
        Returns:
        true if the user is authenticated, false otherwise
      • hasRole

        public boolean hasRole​(java.lang.String role)
        If the current user has a specific role.
        Specified by:
        hasRole in interface SecurityService
        Parameters:
        role - the role to check
        Returns:
        true if the current user has the role, false otherwise