public interface TokenGenerator
Modifier and Type | Method and Description |
---|---|
java.lang.String |
generateInvoiceToken(OrderRequest orderRequest,
MinimalInvoice invoice,
RequestData requestData,
java.time.Instant expireDate,
java.time.Instant notBefore,
java.lang.String recipientSubject)
Help method to generate a JWT token containing a invoice data claim.
|
java.lang.String |
generatePaymentToken(OrderRequest orderRequest,
Order order,
RequestData requestData,
java.time.Instant expireDate,
java.time.Instant notBefore,
java.lang.String recipientSubject)
Help method to generate a JWT token containing a payment data claim.
|
java.lang.String |
generateSettlementToken(OrderRequest orderRequest,
Settlement settlement,
RequestData requestData,
java.time.Instant expireDate,
java.time.Instant notBefore,
java.lang.String recipientSubject)
Help method to generate a JWT token containing a settlement data claim.
|
java.lang.String |
generateToken(java.lang.String tokenContextType,
java.time.Instant expireDate,
java.time.Instant notBefore,
boolean encrypt,
java.lang.String recipientSubject,
JWTClaim... claim)
General method to generate JWT token that is JWS signed and optionally JWE encrypted.
|
PreImageData |
genPreImageData()
Method that should generate a random pre image data used to
create invoice.
|
java.lang.String |
getIssuerName(java.lang.String tokenContextType)
Method to retrieve the issuer claim in generated JWT tokens.
|
org.jose4j.jwt.JwtClaims |
parseToken(java.lang.String tokenContextType,
java.lang.String jwtToken)
Method to parse, verify signature and decrypt (if encrypted) a token.
|
PreImageData genPreImageData() throws InternalErrorException
InternalErrorException
- if internal errors occurred generating
the pre image data.java.lang.String generatePaymentToken(OrderRequest orderRequest, Order order, RequestData requestData, java.time.Instant expireDate, java.time.Instant notBefore, java.lang.String recipientSubject) throws TokenException, java.io.IOException, InternalErrorException
orderRequest
- the order request derived from the payment required annotation.order
- the payment data to include in the token.requestData
- optional request data that could be set if workflow requires it.expireDate
- the expire date of the token in the future.notBefore
- an optional not before data, indicating when the token starts to become valid. Use null not to set.recipientSubject
- the subject (usually keyId) of the recipient, required if asymmetrical keys are used, otherwise it
can be null.TokenException
- if problems occurred looking up the recipient public key.java.io.IOException
- if communication problems occurred with underlying systems.InternalErrorException
- if internal problems occurred processing the token.java.lang.String generateInvoiceToken(OrderRequest orderRequest, MinimalInvoice invoice, RequestData requestData, java.time.Instant expireDate, java.time.Instant notBefore, java.lang.String recipientSubject) throws TokenException, java.io.IOException, InternalErrorException
orderRequest
- the order request derived from the payment required annotation.invoice
- the invoice data to include in the token.requestData
- optional request data that could be set if workflow requires it.expireDate
- the expire date of the token in the future.notBefore
- an optional not before data, indicating when the token starts to become valid. Use null not to set.recipientSubject
- the subject (usually keyId) of the recipient, required if asymmetrical keys are used, otherwise it
can be null.TokenException
- if problems occurred looking up the recipient public key.java.io.IOException
- if communication problems occurred with underlying systems.InternalErrorException
- if internal problems occurred processing the token.java.lang.String generateSettlementToken(OrderRequest orderRequest, Settlement settlement, RequestData requestData, java.time.Instant expireDate, java.time.Instant notBefore, java.lang.String recipientSubject) throws TokenException, java.io.IOException, InternalErrorException
orderRequest
- the order request derived from the payment required annotation.settlement
- the settlement data to include in the token.requestData
- optional request data that could be set if workflow requires it.expireDate
- the expire date of the token in the future.notBefore
- an optional not before data, indicating when the token starts to become valid. Use null not to set.recipientSubject
- the subject (usually keyId) of the recipient, required if asymmetrical keys are used, otherwise it
can be null.TokenException
- if problems occurred looking up the recipient public key.java.io.IOException
- if communication problems occurred with underlying systems.InternalErrorException
- if internal problems occurred processing the token.java.lang.String generateToken(java.lang.String tokenContextType, java.time.Instant expireDate, java.time.Instant notBefore, boolean encrypt, java.lang.String recipientSubject, JWTClaim... claim) throws TokenException, java.io.IOException, InternalErrorException
tokenContextType
- the type the token contextexpireDate
- the expire date of the token in the future.notBefore
- an optional not before data, indicating when the token starts to become valid. Use null not to set.encrypt
- true if JWE encrypted token should be generated.recipientSubject
- the subject (usually keyId) of the recipient, required if asymmetrical keys are used, otherwise it
can be null.claim
- a list of claims to include in the token.TokenException
- if problems occurred looking up the recipient public key.java.io.IOException
- if communication problems occurred with underlying systems.InternalErrorException
- if internal problems occurred processing the token.org.jose4j.jwt.JwtClaims parseToken(java.lang.String tokenContextType, java.lang.String jwtToken) throws TokenException, java.io.IOException, InternalErrorException
tokenContextType
- the type of token context used when parsing a token.jwtToken
- The JWT token string data to parse.TokenException
- if problems occurred parsing, verifying or decrypting the token.java.io.IOException
- if communication problems occurred with underlying systems.InternalErrorException
- if internal problems occurred processing the token.java.lang.String getIssuerName(java.lang.String tokenContextType) throws InternalErrorException
tokenContextType
- the related token context.InternalErrorException
- if internal problems occurred retrieving the issuer name for the given context.