public class DefaultJwtConfiguration extends Object implements JwtConfiguration
JwtConfiguration
implementationModifier and Type | Class and Description |
---|---|
static class |
DefaultJwtConfiguration.ConfigurationBuilder
Default
Builder implementation. |
JwtConfiguration.Builder, JwtConfiguration.InvalidJwtConfigurationException
CONTEXT_KEY
Constructor and Description |
---|
DefaultJwtConfiguration() |
Modifier and Type | Method and Description |
---|---|
long |
getExpireTime()
Get JWT token expire time.
|
Optional<String> |
getIssuer()
Get the JWT token issuer (iss)
|
Optional<Key> |
getPrivateKey()
Get the private key to be used with asymmetric JWT signature algorithms.
|
Optional<Key> |
getPublicKey()
Get the public key to be used with asymmetric JWT signature algorithms.
|
Optional<byte[]> |
getSharedKey()
Get the shared key to be used with symmetric JWT signature algorithms.
|
JwtSignatureAlgorithm |
getSignatureAlgorithm()
Get the JWT token signature algorithm.
|
boolean |
isIncludeDetails()
Get whether to include
Authentication details in JWT token at token generation time. |
boolean |
isIncludePermissions()
Get whether to include
Authentication permissions in JWT token at token generation time. |
boolean |
isNotBeforeNow()
Get whether to set the
nbf (not before) JWT claim to the timestamp at which the token is created. |
void |
setExpireTime(long expireTime)
Set JWT token expire time
|
void |
setIncludeDetails(boolean includeDetails)
Set whether to include
Authentication details in JWT token generation |
void |
setIncludePermissions(boolean includePermissions)
Set whether to include
Authentication permissions in JWT token generation |
void |
setIssuer(String issuer)
JWT token issuer
|
void |
setNotBeforeNow(boolean notBeforeNow)
Set whether to set the
nbf (not before) JWT claim to the timestamp at which the token is created. |
void |
setPrivateKey(Key privateKey)
Set JWT signing private key to use with asymmetric signing algorithms (such as RSA)
|
void |
setPublicKey(Key publicKey)
Set JWT signing public key to use with asymmetric signing algorithms (such as RSA)
|
void |
setSharedKey(byte[] sharedKey)
Set JWT signing shared key to use with symmetric signing algorithms (such as HMAC)
|
void |
setSignatureAlgorithm(JwtSignatureAlgorithm signatureAlgorithm)
Set JWT token signature algorithm
|
String |
toString() |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
build, builder, getCurrent
public Optional<String> getIssuer()
JwtConfiguration
getIssuer
in interface JwtConfiguration
public JwtSignatureAlgorithm getSignatureAlgorithm()
JwtConfiguration
getSignatureAlgorithm
in interface JwtConfiguration
JwtSignatureAlgorithm.NONE
if the JWT token is not signedpublic Optional<byte[]> getSharedKey()
JwtConfiguration
getSharedKey
in interface JwtConfiguration
public Optional<Key> getPublicKey()
JwtConfiguration
getPublicKey
in interface JwtConfiguration
public Optional<Key> getPrivateKey()
JwtConfiguration
getPrivateKey
in interface JwtConfiguration
public long getExpireTime()
JwtConfiguration
getExpireTime
in interface JwtConfiguration
<=0
means token never expirespublic boolean isNotBeforeNow()
JwtConfiguration
nbf
(not before) JWT claim to the timestamp at which the token is created.isNotBeforeNow
in interface JwtConfiguration
true
to set the nbf
(not before) JWT claim to the timestamp at which the token
is createdpublic boolean isIncludeDetails()
JwtConfiguration
Authentication
details in JWT token at token generation time.isIncludeDetails
in interface JwtConfiguration
true
to include Authentication
details in JWT token, false
otherwisepublic boolean isIncludePermissions()
JwtConfiguration
Authentication
permissions in JWT token at token generation time.isIncludePermissions
in interface JwtConfiguration
true
to include Authentication
permissions in JWT token, false
otherwisepublic void setIssuer(String issuer)
issuer
- the issuer to setpublic void setSignatureAlgorithm(JwtSignatureAlgorithm signatureAlgorithm)
signatureAlgorithm
- Signature algorithmpublic void setSharedKey(byte[] sharedKey)
sharedKey
- the key to setpublic void setPublicKey(Key publicKey)
publicKey
- the key to setpublic void setPrivateKey(Key privateKey)
privateKey
- the key to setpublic void setExpireTime(long expireTime)
expireTime
- Expire time in millisecondspublic void setNotBeforeNow(boolean notBeforeNow)
nbf
(not before) JWT claim to the timestamp at which the token is created.notBeforeNow
- true
to set the nbf
(not before) JWT claim to the timestamp at
which the token is created.public void setIncludeDetails(boolean includeDetails)
Authentication
details in JWT token generationincludeDetails
- true
to include Authentication
detailspublic void setIncludePermissions(boolean includePermissions)
Authentication
permissions in JWT token generationincludePermissions
- true
to include Authentication
permissionsCopyright © 2019 The Holon Platform. All rights reserved.