Class UserTokenAPI
java.lang.Object
de.xima.fc.api.ASubAPI
de.xima.fc.api.entity.UserTokenAPI
API class for reading and writing
UserRefreshToken entities.- Since:
- 8.0.0
- Author:
- XIMA Media GmbH
-
Method Summary
Modifier and TypeMethodDescriptioncreateRefreshToken(UserContext uc, @NotNull RefreshTokenUserDataDTO refreshTokenUserDataDTO, String issuer, @NotNull IClientDescriptor clientDescriptor) Creates a refresh token.static UserTokenAPIReturns the singleton instance of this class.getRefreshTokenUserData(UserContext uc, @NotNull String refreshToken) Get the refresh token user data.getRefreshTokenUserData(UserContext uc, @NotNull UUID refreshTokenId) Get the refresh token user data.Returns the token configuration for the given user context.getUserRefreshTokens(UserContext uc, IUser user) Get all refresh tokens for the given user.booleanisValidRefreshToken(UserContext uc, @NotNull UUID refreshTokenId) Validates the given refresh token.booleanremoveRefreshToken(UserContext uc, UserRefreshToken token) Removes the refresh token.booleanremoveRefreshToken(UserContext uc, String refreshToken) Removes the refresh token.updateRefreshToken(UserContext uc, @NotBlank String refreshToken, @NotNull IClientDescriptor clientDescriptor) Updates the refresh token.Methods inherited from class ASubAPI
getHandlerProvider
-
Method Details
-
getInstance
Returns the singleton instance of this class.- Returns:
- The singleton instance.
-
getTokenConfiguration
Returns the token configuration for the given user context.- Parameters:
uc- The user context.- Returns:
- The token configuration.
-
isValidRefreshToken
Validates the given refresh token.- Parameters:
uc- The user context.refreshTokenId- The refresh token id.- Returns:
- True if the refresh token is valid, false otherwise.
-
updateRefreshToken
public UserRefreshToken updateRefreshToken(UserContext uc, @NotBlank @NotBlank String refreshToken, @NotNull @NotNull IClientDescriptor clientDescriptor) throws InvalidTokenException, UnknownTokenException Updates the refresh token.- Parameters:
uc- The user context.refreshToken- The refresh token.clientDescriptor- The client descriptor.- Returns:
- The updated refresh token.
- Throws:
InvalidTokenException- If the token is invalid.UnknownTokenException- If the token is unknown.
-
createRefreshToken
public UserRefreshToken createRefreshToken(UserContext uc, @NotNull @NotNull RefreshTokenUserDataDTO refreshTokenUserDataDTO, String issuer, @NotNull @NotNull IClientDescriptor clientDescriptor) throws TokenCreateException Creates a refresh token.- Parameters:
uc- The user context.refreshTokenUserDataDTO- The refresh token user data.issuer- The issuer.clientDescriptor- The client descriptor.- Returns:
- The created refresh token.
- Throws:
TokenCreateException- If the token creation fails.
-
removeRefreshToken
Removes the refresh token.- Parameters:
uc- The user context.refreshToken- The refresh token.- Returns:
- True if the refresh token was removed, false otherwise.
-
removeRefreshToken
Removes the refresh token.- Parameters:
uc- The user context.token- The refresh token.- Returns:
- True if the refresh token was removed, false otherwise.
-
getUserRefreshTokens
Get all refresh tokens for the given user.- Parameters:
uc- The user context.user- The user.- Returns:
- The list of refresh tokens.
-
getRefreshTokenUserData
public RefreshTokenUserDataDTO getRefreshTokenUserData(UserContext uc, @NotNull @NotNull UUID refreshTokenId) throws InvalidTokenException Get the refresh token user data.- Parameters:
uc- The user context.refreshTokenId- The refresh token id.- Returns:
- The refresh token user data.
- Throws:
InvalidTokenException- If the token is invalid.
-
getRefreshTokenUserData
public RefreshTokenUserDataDTO getRefreshTokenUserData(UserContext uc, @NotNull @NotNull String refreshToken) throws InvalidTokenException Get the refresh token user data.- Parameters:
uc- The user context.refreshToken- The refresh token.- Returns:
- The refresh token user data.
- Throws:
InvalidTokenException- If the token is invalid.
-