Interface AuthService

    • Method Detail

      • getAuthentication

        org.springframework.security.core.Authentication getAuthentication​(javax.servlet.http.HttpServletRequest request)
      • addAuthentication

        void addAuthentication​(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response,
                               org.springframework.security.core.Authentication authentication)
        Add the authentication on the response after performs other operations like persistence server side
        Parameters:
        request - the http request
        response - the http response
        authentication - the authentication
      • extractUserAppRoles

        Collection<String> extractUserAppRoles​(Collection<String> roles)
        Parameters:
        roles - a collection of roles
        Returns:
        the intersection between aplication defined roles and the one from the collection
      • getTokenUser

        default TokenUser getTokenUser​(org.springframework.security.core.Authentication authentication)
        Parameters:
        authentication - the spring security Authentication
        Returns:
        the Token user
      • fromJSON

        default TokenUser fromJSON​(String userJSON)
        Parameters:
        userJSON - representation of the TokenUser
        Returns:
        the TokenUser
      • toJSON

        default String toJSON​(TokenUser user)
        Parameters:
        user - the TokenUser to be serializes
        Returns:
        the json string representing TokenUser
      • parseUserFromToken

        default TokenUser parseUserFromToken​(String token,
                                             String secret)
        Parameters:
        token - the encoded token
        secret - secret phrase to decode
        Returns:
        parsed TokenUser
      • createTokenForUser

        default String createTokenForUser​(TokenUser user,
                                          String secret)
        Parameters:
        user - the user to create token for
        secret - the secret for signature
        Returns:
        jwt token
      • getTokenTimeout

        long getTokenTimeout()
        Returns:
        milliseconds until expiration