Interface TokenService

  • All Known Implementing Classes:
    DefaultTokenService

    public interface TokenService
    Interface which provides methods for managing token for user
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean checkIfTokenIsValid​(java.lang.String userId, java.lang.String tokenToCheck)
      Method verifies if passed token for particular user is valid
      java.lang.String getOrCreateTokenForUser​(java.lang.String userId)
      Method should return the current token assigned to user or create it and return it if the token does not exist
      boolean revokeTokenForUser​(java.lang.String userId)
      Method should invalidate the current token for user
    • Method Detail

      • getOrCreateTokenForUser

        java.lang.String getOrCreateTokenForUser​(java.lang.String userId)
        Method should return the current token assigned to user or create it and return it if the token does not exist
        Parameters:
        userId - uid
        Returns:
        token assigned to user
      • revokeTokenForUser

        boolean revokeTokenForUser​(java.lang.String userId)
        Method should invalidate the current token for user
        Parameters:
        userId - uid
        Returns:
        true if operation was successful
      • checkIfTokenIsValid

        boolean checkIfTokenIsValid​(java.lang.String userId,
                                    java.lang.String tokenToCheck)
        Method verifies if passed token for particular user is valid
        Parameters:
        userId - uid
        tokenToCheck - token to be verified
        Returns:
        true if the token submitted for verification matches the one currently assigned to the user