public class DefaultJWTSigningAndValidationService extends Object implements JWTSigningAndValidationService
Constructor and Description |
---|
DefaultJWTSigningAndValidationService(JWKSetKeyStore keyStore)
Build this service based on the given keystore.
|
DefaultJWTSigningAndValidationService(Map<String,com.nimbusds.jose.jwk.JWK> keys)
Build this service based on the keys given.
|
Modifier and Type | Method and Description |
---|---|
Map<String,com.nimbusds.jose.jwk.JWK> |
getAllPublicKeys()
Get all public keys for this service, mapped by their Key ID
|
Collection<com.nimbusds.jose.JWSAlgorithm> |
getAllSigningAlgsSupported()
Get the list of all signing algorithms supported by this service.
|
String |
getDefaultSignerKeyId() |
com.nimbusds.jose.JWSAlgorithm |
getDefaultSigningAlgorithm()
Get the default signing algorithm for use when nothing else has been specified.
|
String |
getDefaultSigningAlgorithmName() |
void |
setDefaultSignerKeyId(String defaultSignerId) |
void |
setDefaultSigningAlgorithmName(String algName) |
void |
signJwt(com.nimbusds.jwt.SignedJWT jwt)
Sign a jwt in place using the configured default signer.
|
void |
signJwt(com.nimbusds.jwt.SignedJWT jwt,
com.nimbusds.jose.JWSAlgorithm alg)
Sign a jwt using the selected algorithm.
|
boolean |
validateSignature(com.nimbusds.jwt.SignedJWT jwt)
Checks the signature of the given JWT against all configured signers,
returns true if at least one of the signers validates it.
|
public DefaultJWTSigningAndValidationService(Map<String,com.nimbusds.jose.jwk.JWK> keys) throws NoSuchAlgorithmException, InvalidKeySpecException
keys
- A map of key identifier to keyInvalidKeySpecException
- If the keys in the JWKs are not validNoSuchAlgorithmException
- If there is no appropriate algorithm to tie the keys to.public DefaultJWTSigningAndValidationService(JWKSetKeyStore keyStore) throws NoSuchAlgorithmException, InvalidKeySpecException
kid
) field in order to be used.keyStore
- the keystore to load all keys fromInvalidKeySpecException
- If the keys in the JWKs are not validNoSuchAlgorithmException
- If there is no appropriate algorithm to tie the keys to.public String getDefaultSignerKeyId()
getDefaultSignerKeyId
in interface JWTSigningAndValidationService
public void setDefaultSignerKeyId(String defaultSignerId)
defaultSignerKeyId
- the defaultSignerKeyId to setpublic com.nimbusds.jose.JWSAlgorithm getDefaultSigningAlgorithm()
JWTSigningAndValidationService
getDefaultSigningAlgorithm
in interface JWTSigningAndValidationService
public void setDefaultSigningAlgorithmName(String algName)
public String getDefaultSigningAlgorithmName()
public void signJwt(com.nimbusds.jwt.SignedJWT jwt)
signJwt
in interface JWTSigningAndValidationService
jwt
- the jwt to signpublic void signJwt(com.nimbusds.jwt.SignedJWT jwt, com.nimbusds.jose.JWSAlgorithm alg)
JWTSigningAndValidationService
signJwt
in interface JWTSigningAndValidationService
jwt
- the jwt to signalg
- the name of the algorithm to use, as specified in JWS s.6public boolean validateSignature(com.nimbusds.jwt.SignedJWT jwt)
JWTSigningAndValidationService
validateSignature
in interface JWTSigningAndValidationService
jwt
- the string representation of the JWT as sent on the wirepublic Map<String,com.nimbusds.jose.jwk.JWK> getAllPublicKeys()
JWTSigningAndValidationService
getAllPublicKeys
in interface JWTSigningAndValidationService
public Collection<com.nimbusds.jose.JWSAlgorithm> getAllSigningAlgsSupported()
JWTSigningAndValidationService
getAllSigningAlgsSupported
in interface JWTSigningAndValidationService
Copyright © 2018. All rights reserved.