Interface EmailRefreshTokenManager

All Known Implementing Classes:
EmailRefreshTokenManagerImpl

@NullMarked public interface EmailRefreshTokenManager
Interface defining methods for management of refresh token used for OAuth2 authentication with SMTP server.
  • Method Details

    • storeRefreshTokenValue

      RefreshToken storeRefreshTokenValue(String refreshTokenValue)
      Stores provided token value to database. It will override previous value of refresh token.
      Parameters:
      refreshTokenValue - token value
      Returns:
      stored RefreshToken instance
    • storeRefreshTokenValue

      default RefreshToken storeRefreshTokenValue(String refreshTokenValue, OAuth2ClientType clientType)
      Stores provided token value and the OAuth2 client type the token was issued to. It will override previous value of refresh token.
      Parameters:
      refreshTokenValue - token value
      clientType - client type the token was issued to
      Returns:
      stored RefreshToken instance
    • getRefreshTokenClientType

      default OAuth2ClientType getRefreshTokenClientType()
      Gets the OAuth2 client type the stored refresh token was issued to.
      Returns:
      stored client type, or OAuth2ClientType.CONFIDENTIAL when unknown
    • getRefreshTokenValue

      String getRefreshTokenValue()
      Gets current value of refresh token.
      Returns:
      token value stored in database. If no token value is stored, the initial value from the 'jmix.email.oauth2.refresh-token' application property is returned. Once a token is stored in the database, the stored value always takes precedence over the property.
      Throws:
      IllegalStateException - if no token is stored and the application property is not set
    • loadRefreshToken

      @Nullable RefreshToken loadRefreshToken()
      Loads refresh token instance from database.
      Returns:
      RefreshToken instance stored in database or null if no token is stored