public class AsymmetricKeyTokenGenerator extends BaseTokenGenerator
ALLOWED_CLOCK_SKEW, PREIMAGE_LENGTH
Constructor and Description |
---|
AsymmetricKeyTokenGenerator(AsymmetricKeyManager keyManager,
RecipientRepository recipientRepository)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getIssuerName(java.lang.String context)
Method to retrieve the issuer claim in generated JWT tokens.
|
protected void |
populateJWEDecryptionAlgAndKey(TokenContext context,
org.jose4j.jwe.JsonWebEncryption jwe)
Method to set the encryption algorithm and key used to deencrypt the token.
|
protected void |
populateJWEEncryptionAlgAndKey(TokenContext context,
java.lang.String recipientSubject,
org.jose4j.jwe.JsonWebEncryption jwe)
Method to set the encryption algorithm and key used to encrypt the token.
|
protected void |
populateJWSSignatureAlgAndKey(TokenContext context,
org.jose4j.jws.JsonWebSignature jws)
Method to set the used RSA_USING_SHA256 algorithm and the private key to sign the data with.
|
protected void |
populateJWSVerifyAlgAndKey(TokenContext context,
org.jose4j.jws.JsonWebSignature jws)
Populates the JWS Signature with a whitelisting of asymmetric key algorithms and the finding the related public key.
|
void |
rebuildCache() |
generateInvoiceToken, generatePaymentToken, generateSettlementToken, generateToken, genPreImageData, getSecureRandom, parseToken
public AsymmetricKeyTokenGenerator(AsymmetricKeyManager keyManager, RecipientRepository recipientRepository)
keyManager
- the KeyManager storing the keys with the generated tokensrecipientRepository
- an implementation of a recipient repository to lookup public key of encrypted
recipients.protected void populateJWSSignatureAlgAndKey(TokenContext context, org.jose4j.jws.JsonWebSignature jws) throws java.io.IOException, InternalErrorException
populateJWSSignatureAlgAndKey
in class BaseTokenGenerator
context
- the related token context.jws
- the signature to populate used algorithm and key for.java.io.IOException
- if communication problems occurred with underlying systems.InternalErrorException
- if internal problems occurred setting the private key.protected void populateJWSVerifyAlgAndKey(TokenContext context, org.jose4j.jws.JsonWebSignature jws) throws TokenException, org.jose4j.lang.JoseException, java.io.IOException, InternalErrorException
populateJWSVerifyAlgAndKey
in class BaseTokenGenerator
context
- the related token context.jws
- the JsonWebSignature to populate.java.io.IOException
- if communication problems occurred with underlying systems.InternalErrorException
- if internal error occurred accessing the asymmetric key.TokenException
- if no trusted signing key could be found.org.jose4j.lang.JoseException
- if JWT problems occurred.public java.lang.String getIssuerName(java.lang.String context) throws InternalErrorException
context
- the related token context.InternalErrorException
- if internal problems occurred retrieving the issuer name for the given context.protected void populateJWEEncryptionAlgAndKey(TokenContext context, java.lang.String recipientSubject, org.jose4j.jwe.JsonWebEncryption jwe) throws TokenException, java.io.IOException, InternalErrorException
populateJWEEncryptionAlgAndKey
in class BaseTokenGenerator
context
- the related token context.recipientSubject
- the subject name of the recipient for the generated token, could be null if not applicable.jwe
- the encryption object to populate used algorithm and key for.TokenException
- if no related encryption key could be found.java.io.IOException
- if communication problems occurred with underlying systems.InternalErrorException
- if internal problem occurred setting the JWE properties.protected void populateJWEDecryptionAlgAndKey(TokenContext context, org.jose4j.jwe.JsonWebEncryption jwe) throws java.io.IOException, InternalErrorException
populateJWEDecryptionAlgAndKey
in class BaseTokenGenerator
context
- the related token context.jwe
- the encryption object to populate used algorithm and key for.java.io.IOException
- if communication problems occurred with underlying systems.InternalErrorException
- if internal problem occurred setting the JWE properties.public void rebuildCache() throws InternalErrorException
InternalErrorException