public interface AccessTokenService
AccessToken
s and authenticating them.Modifier and Type | Method and Description |
---|---|
@NotNull Optional<AccessToken> |
authenticate(@NotNull String rawToken)
Authenticate by raw token
|
@NotNull RawAccessToken |
create(@NotNull CreateAccessTokenRequest createAccessTokenRequest)
Create new access token for user.
|
void |
deleteByTokenId(@NotNull String tokenId)
Delete one token with tokenId.
|
void |
deleteByUserName(@NotNull String userName)
Delete all tokens for given user name
|
@NotNull List<AccessToken> |
getAccessTokensByUserName(@NotNull String userName)
Get All tokens for given user name.
|
@NotNull @NotNull RawAccessToken create(@NotNull @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 @NotNull List<AccessToken> getAccessTokensByUserName(@NotNull @NotNull String userName) throws UnauthorisedException
userName
- UnauthorisedException
- on non-admin tries to get other user tokensvoid deleteByTokenId(@NotNull @NotNull String tokenId) throws UnauthorisedException
tokenId
- UnauthorisedException
- on non-admin tries to delete other user tokenvoid deleteByUserName(@NotNull @NotNull String userName) throws UnauthorisedException
userName
- UnauthorisedException
- on non-admin tries to delete other user tokens@NotNull @NotNull Optional<AccessToken> authenticate(@NotNull @NotNull String rawToken)
rawToken
- created by create(CreateAccessTokenRequest)
methodAccessToken
When user exists & is enabled and token is valid,
otherwise Optional.empty()
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.