public interface AccessTokenService
AccessToken
s and authenticating them.Modifier and Type | Method and Description |
---|---|
Optional<AccessToken> |
authenticate(String rawToken)
Authenticate by raw token
|
RawAccessToken |
create(CreateAccessTokenRequest createAccessTokenRequest)
Create new access token for user.
|
void |
deleteByTokenId(String tokenId)
Delete one token with tokenId.
|
void |
deleteByUserName(String userName)
Delete all tokens for given user name
|
List<AccessToken> |
getAccessTokensByUserName(String userName)
Get All tokens for given user name.
|
@NotNull RawAccessToken create(@NotNull CreateAccessTokenRequest createAccessTokenRequest) throws TokenLimitExceededException, CreateTokenFailedException, UnauthorisedException, TokenWithNameExistsException
createAccessTokenRequest
- RawAccessToken
, RawAccessToken.getRawToken()
can be used in authenticate(String)
TokenLimitExceededException
- when user already has maximum number of tokensCreateTokenFailedException
- when can not generate unique token idUnauthorisedException
- when try create token for other user than current logged inTokenWithNameExistsException
- when user already has token with name@NotNull List<AccessToken> getAccessTokensByUserName(@NotNull String userName) throws UnauthorisedException
userName
- UnauthorisedException
- on non-admin tries to get other user tokensvoid deleteByTokenId(@NotNull String tokenId) throws UnauthorisedException
tokenId
- UnauthorisedException
- on non-admin tries to delete other user tokenvoid deleteByUserName(@NotNull String userName) throws UnauthorisedException
userName
- UnauthorisedException
- on non-admin tries to delete other user tokens@NotNull Optional<AccessToken> authenticate(@NotNull String rawToken)
rawToken
- created by create(CreateAccessTokenRequest)
methodAccessToken
When user exists & is enabled and token is valid,
otherwise Optional.empty()
Copyright © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.