Interface OAuthTokenService

All Known Implementing Classes:
DefaultOAuthTokenService

public interface OAuthTokenService
Service for managing OAuth access and refresh tokens
Spring Bean ID:
oauthTokenService
  • Method Details

    • getAccessToken

      OAuthAccessTokenModel getAccessToken(String id)
      Returns access token for given identifier (key)
      Parameters:
      id - token identifier
      Returns:
      access token with given id
      Throws:
      IllegalArgumentException - when 'id' parameter is null
      UnknownIdentifierException - when access token with given id doesn't exist
    • saveAccessToken

      void saveAccessToken(OAuthAccessTokenModel accessTokenModel)
      Save access token
      Parameters:
      accessTokenModel - Access token model to save
    • saveAccessToken

      OAuthAccessTokenModel saveAccessToken(String accessTokenId, Object accessToken, String authenticationId, Object authentication, String userName, String clientId, OAuthRefreshTokenModel refreshTokenModel)
      Saves access token attributes in access token model.
      If access token model with given id doesn't exist, new access token model is created.
      Parameters:
      accessTokenId - Access token identifier
      accessToken - Access token object
      authenticationId - Authentication identifier
      authentication - Authentication object
      userName - User name
      clientId - Client identifier
      refreshTokenModel - Refresh token model belong
      Returns:
      Saved access token model
    • removeAccessToken

      void removeAccessToken(String id)
      Remove access token
      Parameters:
      id - Access token identifier
    • getRefreshToken

      OAuthRefreshTokenModel getRefreshToken(String id)
      Returns refresh token for given identifier (key)
      Parameters:
      id - refresh token identifier
      Returns:
      refresh token with given id
      Throws:
      IllegalArgumentException - when 'id' parameter is null
      UnknownIdentifierException - when refresh token with given id doesn't exist
    • saveRefreshToken

      void saveRefreshToken(OAuthRefreshTokenModel refreshTokenModel)
      Save refresh token model
      Parameters:
      refreshTokenModel - Model to save
    • saveRefreshToken

      OAuthRefreshTokenModel saveRefreshToken(String refreshTokenId, Object refreshToken, Object authentication)
      Saves refresh token attributes in refresh token model.
      If refresh token model for given id doesn't exist, new refresh token model is created.
      Parameters:
      refreshTokenId - Refresh token identifier
      refreshToken - Refresh token object
      authentication - Authentication object
      Returns:
      Saved refresh token model
    • removeRefreshToken

      void removeRefreshToken(String id)
      Remove refresh token with given identifier
      Parameters:
      id - - refresh token identifier (key)
    • removeAccessTokenUsingRefreshToken

      void removeAccessTokenUsingRefreshToken(String refreshTokenId)
      Removes access tokens related to refresh token
      Parameters:
      refreshTokenId - Refresh token identifier
    • getAccessTokenListForRefreshToken

      List<OAuthAccessTokenModel> getAccessTokenListForRefreshToken(String refreshTokenId)
      Returns list of access tokens for refresh token
      Parameters:
      refreshTokenId - Refresh token identifier
      Returns:
      List of access tokens for refresh token or empty list
    • getAccessTokensForClient

      List<OAuthAccessTokenModel> getAccessTokensForClient(String clientId)
      Returns access tokens for client
      Parameters:
      clientId - Client identifier
      Returns:
      List of access tokens for client or empty list
    • getAccessTokensForUser

      List<OAuthAccessTokenModel> getAccessTokensForUser(String userName)
      Returns access tokens for user with given user name
      Parameters:
      userName - User name
      Returns:
      List of access tokens for user or empty list
    • getAccessTokenForAuthentication

      OAuthAccessTokenModel getAccessTokenForAuthentication(String authenticationId)
      Returns access token for given authentication
      Parameters:
      authenticationId - authentication identifier
      Returns:
      access token
      Throws:
      IllegalArgumentException - when authenticationId is null
      UnknownIdentifierException - when there is no access token related to given authentication
      AmbiguousIdentifierException - when there is multiple access token related to given authentication
    • removeAccessTokenForAuthentication

      void removeAccessTokenForAuthentication(String authenticationId)
      Removes access tokens related to authentication
      Parameters:
      authenticationId - authentication identifier
      Throws:
      IllegalArgumentException - when authenticationId is null
    • getAccessTokensForClientAndUser

      List<OAuthAccessTokenModel> getAccessTokensForClientAndUser(String clientId, String userName)
      Returns access tokens based on user and client
      Parameters:
      clientId - Client identifier
      userName - User name
      Returns:
      List of access tokens or empty list