public abstract class KeyResolverAdapter extends java.lang.Object implements KeyResolver
KeyResolver interface that allows subclasses to process only the type of paseto token that
is known/expected for a particular case.
The resolvePublicKey(Version, Purpose, FooterClaims) and
resolveSharedKey(Version, Purpose, FooterClaims) method implementations delegate to the
resolvePublicKeyBytes(Version, Purpose, FooterClaims) and
resolveSharedKeyBytes(Version, Purpose, FooterClaims) methods respectively. The latter two methods
simply throw exceptions: they represent scenarios expected by calling code in known situations, and it is expected
that you override the implementation in those known situations; non-overridden *KeyBytes methods indicates that the
token input was unexpected.
If either resolvePublicKey(Version, Purpose, FooterClaims) and resolveSharedKey(Version, Purpose, FooterClaims)
are not overridden, one (or both) of the *KeyBytes variants must be overridden depending on your expected
use case. You do not have to override any method that does not represent an expected condition.
| Constructor and Description |
|---|
KeyResolverAdapter() |
| Modifier and Type | Method and Description |
|---|---|
java.security.PublicKey |
resolvePublicKey(Version version,
Purpose purpose,
FooterClaims footer)
Returns the signing key that should be used to validate a digital signature for the paseto token.
|
protected byte[] |
resolvePublicKeyBytes(Version version,
Purpose purpose,
FooterClaims footer)
Convenience method invoked by
resolvePublicKey(Version, Purpose, FooterClaims) that obtains the
necessary public key bytes. |
javax.crypto.SecretKey |
resolveSharedKey(Version version,
Purpose purpose,
FooterClaims footer)
Returns the signing key that should be used to validate a digital signature for the paseto token.
|
protected byte[] |
resolveSharedKeyBytes(Version version,
Purpose purpose,
FooterClaims footer)
Convenience method invoked by
resolveSharedKey(Version, Purpose, FooterClaims) that obtains the
necessary signing key bytes. |
public java.security.PublicKey resolvePublicKey(Version version, Purpose purpose, FooterClaims footer)
KeyResolverresolvePublicKey in interface KeyResolverversion - the version of the token to be parsedpurpose - the purpose of the token to be parsedfooter - the footer containing claims or plain text of the token to be parsedpublic javax.crypto.SecretKey resolveSharedKey(Version version, Purpose purpose, FooterClaims footer)
KeyResolverresolveSharedKey in interface KeyResolverversion - the version of the token to be parsedpurpose - the purpose of the token to be parsedfooter - the footer containing claims or plain text of the token to be parsedprotected byte[] resolvePublicKeyBytes(Version version, Purpose purpose, FooterClaims footer)
resolvePublicKey(Version, Purpose, FooterClaims) that obtains the
necessary public key bytes. This implementation simply throws an exception: if the paseto token parsed
is 'public'.version - the version of the token to be parsedpurpose - the purpose of the token to be parsedfooter - the footer containing claims or plain text of the token to be parsedprotected byte[] resolveSharedKeyBytes(Version version, Purpose purpose, FooterClaims footer)
resolveSharedKey(Version, Purpose, FooterClaims) that obtains the
necessary signing key bytes. This implementation simply throws an exception: if the paseto token
parsed is 'local'.version - the version of the token to be parsedpurpose - the purpose of the token to be parsedfooter - the footer containing claims or plain text of the token to be parsedCopyright © 2019-2020 paseto.dev. All Rights Reserved.