Package io.jmix.email.authentication
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 Summary
Modifier and TypeMethodDescriptiondefault OAuth2ClientTypeGets the OAuth2 client type the stored refresh token was issued to.Gets current value of refresh token.@Nullable RefreshTokenLoads refresh token instance from database.storeRefreshTokenValue(String refreshTokenValue) Stores provided token value to database.default RefreshTokenstoreRefreshTokenValue(String refreshTokenValue, OAuth2ClientType clientType) Stores provided token value and the OAuth2 client type the token was issued to.
-
Method Details
-
storeRefreshTokenValue
Stores provided token value to database. It will override previous value of refresh token.- Parameters:
refreshTokenValue- token value- Returns:
- stored
RefreshTokeninstance
-
storeRefreshTokenValue
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 valueclientType- client type the token was issued to- Returns:
- stored
RefreshTokeninstance
-
getRefreshTokenClientType
Gets the OAuth2 client type the stored refresh token was issued to.- Returns:
- stored client type, or
OAuth2ClientType.CONFIDENTIALwhen 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:
RefreshTokeninstance stored in database or null if no token is stored
-