10Duke Java Core
|
Default implementation of the JwtService
that provides functionality for basic operations such as building, signing and parsing JWTs.
Public Member Functions | |
DefaultJwtService (final String keyId, final PrivateKey signingKey) | |
Creates a new instance of this class for building and signing JWT's. | |
DefaultJwtService (final String keyId, final PublicKey verificationKey) | |
Creates a new instance of this class for verifying and parsing JWT's. | |
DefaultJwtService (final String signingKeyId, final PrivateKey signingKey, final String verificationKeyId, final PublicKey verificationKey) | |
Creates a new instance of this class for both building and signing JWT's and to parse and verify JWT's. | |
String | buildAndSign (final Map< String, Object > claims) |
Builds and signs a JWT. | |
String | buildAndSign (final String data) |
Builds and signs a JWT. | |
JwtToken | parse (final String jwt) |
Parses a String to a JwtToken and validates the signature. | |
JwtToken | parseNoVerify (final String jwt) |
Parses a String to a JwtToken and skips signature verification. | |
DefaultJwtService | withTypHeaderValidationDisabled () |
Turns JWT typ header claim validation off. | |
String | signingKeyId () |
Returns the key id for the private key that is used to sign JWT's. | |
String | verificationKeyId () |
Returns the key id for the public key that is used to validate JWT's. | |
![]() | |
String | readKeyIdHeader (final String jwt) |
Reads a key id from the JWT header. | |
![]() | |
![]() |
Protected Member Functions | |
JwtConsumer | configureJwtParser () |
Configures JwtConsumer with the verification key and the correct settings. | |
void | assertKeyIsValid (final PrivateKey key) |
Asserts that the private key is valid for use. | |
void | assertModeEnablesSign () |
Asserts that current service mode allows signing JWTs. | |
void | assertModeEnablesVerify () |
Asserts that current service model allows verifying JWTs. | |
![]() | |
void | assertJwtHeadersAreValid (final String jwt) |
Checks that headers are sane. | |
Additional Inherited Members | |
![]() | |
String | HEADER_SIGNATURE_ALGORITHM = "alg" |
Header claim name for signature algorithm. | |
String | HEADER_KEY_ID = "kid" |
Header claim name for key id. | |
String | HEADER_TYPE = "typ" |
Header claim name for token type. | |
String | TOKEN_TYPE_JWT = "JWT" |
Header claim type that denotes a JWT. | |
String | SIGNATURE_ALGORITHM_RSA_SHA = "RS256" |
Header value for alg claim, denotes RSA-SHA algorithm used for JWT signatures. | |
tenduke.sdk.core.service.impl.DefaultJwtService.DefaultJwtService | ( | final String | keyId, |
final PrivateKey | signingKey ) |
Creates a new instance of this class for building and signing JWT's.
keyId | Signing key id. |
signingKey | The signing key. |
tenduke.sdk.core.service.impl.DefaultJwtService.DefaultJwtService | ( | final String | keyId, |
final PublicKey | verificationKey ) |
Creates a new instance of this class for verifying and parsing JWT's.
keyId | Verification key id. |
verificationKey | The signature verification key. |
tenduke.sdk.core.service.impl.DefaultJwtService.DefaultJwtService | ( | final String | signingKeyId, |
final PrivateKey | signingKey, | ||
final String | verificationKeyId, | ||
final PublicKey | verificationKey ) |
Creates a new instance of this class for both building and signing JWT's and to parse and verify JWT's.
signingKeyId | Signing key id. |
signingKey | The signing key. |
verificationKeyId | The verification key id. |
verificationKey | The verification key. |
|
protected |
Asserts that the private key is valid for use.
key | The key to validate. |
String tenduke.sdk.core.service.impl.DefaultJwtService.buildAndSign | ( | final Map< String, Object > | claims | ) |
Builds and signs a JWT.
claims | A map with key value pairs to use as JWT body JSON data definition. |
Implements tenduke.sdk.core.service.JwtService.
String tenduke.sdk.core.service.impl.DefaultJwtService.buildAndSign | ( | final String | data | ) |
Builds and signs a JWT.
data | Data to use as such for the JWT body. |
Implements tenduke.sdk.core.service.JwtService.
|
protected |
Configures JwtConsumer
with the verification key and the correct settings.
JwtToken tenduke.sdk.core.service.impl.DefaultJwtService.parse | ( | final String | jwt | ) |
Parses a String to a JwtToken and validates the signature.
jwt | The String to parse and validate. |
Implements tenduke.sdk.core.service.JwtService.
JwtToken tenduke.sdk.core.service.impl.DefaultJwtService.parseNoVerify | ( | final String | jwt | ) |
Parses a String to a JwtToken and skips signature verification.
jwt | The String to parse and validate. |
Implements tenduke.sdk.core.service.JwtService.
String tenduke.sdk.core.service.impl.DefaultJwtService.signingKeyId | ( | ) |
Returns the key id for the private key that is used to sign JWT's.
Implements tenduke.sdk.core.service.JwtService.
String tenduke.sdk.core.service.impl.DefaultJwtService.verificationKeyId | ( | ) |
Returns the key id for the public key that is used to validate JWT's.
Implements tenduke.sdk.core.service.JwtService.
DefaultJwtService tenduke.sdk.core.service.impl.DefaultJwtService.withTypHeaderValidationDisabled | ( | ) |
Turns JWT typ header claim validation off.
Reimplemented from tenduke.sdk.core.service.impl.DefaultJwtMetadataParser.