Package sonia.scm.security
Interface AccessTokenBuilder
public interface AccessTokenBuilder
The access token builder is able to create
AccessToken
. For more informations about access tokens have look
at AccessToken
.- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a newAccessToken
with the provided settings.Adds a custom entry to the token.Sets the expiration for the token.Sets the issuer for the token.refreshableFor
(long count, TimeUnit unit) Sets the time how long this token may be refreshed.Reduces the permissions of the token by providing a scope.Sets the subject for the token.
-
Method Details
-
subject
Sets the subject for the token. If the subject is not set the currently authenticated subject will be used instead.- Parameters:
subject
- subject of token- Returns:
- * @return
this
-
custom
Adds a custom entry to the token.- Parameters:
key
- key of custom entryvalue
- value of entry- Returns:
this
-
issuer
Sets the issuer for the token.- Parameters:
issuer
- issuer name or url- Returns:
this
-
expiresIn
Sets the expiration for the token.- Parameters:
count
- expiration countunit
- expiration unit- Returns:
this
-
refreshableFor
Sets the time how long this token may be refreshed. Set this to 0 (zero) to disable automatic refresh.- Parameters:
count
- Time unit count. If set to 0, automatic refresh is disabled.unit
- time unit- Returns:
this
-
scope
Reduces the permissions of the token by providing a scope.- Parameters:
scope
- scope of token- Returns:
this
-
build
AccessToken build()Creates a newAccessToken
with the provided settings.- Returns:
- new
AccessToken
-