Class FallbackJwtCryptographyHandler
- java.lang.Object
-
- org.forgerock.jaspi.modules.session.jwt.FallbackJwtCryptographyHandler
-
- All Implemented Interfaces:
JwtCryptographyHandler
public class FallbackJwtCryptographyHandler extends Object implements JwtCryptographyHandler
A cryptography handler that tries multipleJwtCryptographyHandler
s in turn for decryption. This is useful when transitioning from one cryptography implementation to another, such as fromKeyStoreJwtCryptographyHandler
toAuthenticatedEncryptionCryptographyHandler
.
-
-
Constructor Summary
Constructors Constructor Description FallbackJwtCryptographyHandler(JwtCryptographyHandler preferredHandler, JwtCryptographyHandler fallbackHandler)
Initializes the handler with the given preferred and fallback handlers.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
buildJwt(JwtBuilderFactory jwtBuilderFactory, JwtClaimsSet claimsSet)
Builds a JWT with the given claims set.void
decrypt(EncryptedThenSignedJwt jwt)
Deprecated.Jwt
decryptAndVerify(JwtBuilderFactory jwtBuilderFactory, String jwt)
Decrypts and verifies that the JWT is authentic in a single step.void
initialize(Map<String,Object> options)
Initialise the handler.EncryptedJwtBuilder
jwe(JwtBuilderFactory jwtbuilder)
Deprecated.EncryptedThenSignedJwtBuilder
sign(EncryptedJwtBuilder jwtbuilder)
Deprecated.boolean
verify(EncryptedThenSignedJwt jwt)
Deprecated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.forgerock.jaspi.modules.session.jwt.JwtCryptographyHandler
buildJwtAsync
-
-
-
-
Constructor Detail
-
FallbackJwtCryptographyHandler
public FallbackJwtCryptographyHandler(JwtCryptographyHandler preferredHandler, JwtCryptographyHandler fallbackHandler)
Initializes the handler with the given preferred and fallback handlers.- Parameters:
preferredHandler
- the preferred cryptography handler.fallbackHandler
- the fallback cryptography handler.
-
-
Method Detail
-
initialize
public void initialize(Map<String,Object> options) throws AuthenticationException
Description copied from interface:JwtCryptographyHandler
Initialise the handler.- Specified by:
initialize
in interfaceJwtCryptographyHandler
- Parameters:
options
- The options to be used.- Throws:
AuthenticationException
- If the options are invalid.
-
verify
@Deprecated public boolean verify(EncryptedThenSignedJwt jwt)
Deprecated.Description copied from interface:JwtCryptographyHandler
Verify the JWT.- Specified by:
verify
in interfaceJwtCryptographyHandler
- Parameters:
jwt
- The JWT.- Returns:
- true if the JWT is valid.
-
decrypt
@Deprecated public void decrypt(EncryptedThenSignedJwt jwt)
Deprecated.Description copied from interface:JwtCryptographyHandler
Decrypt the JWT.- Specified by:
decrypt
in interfaceJwtCryptographyHandler
- Parameters:
jwt
- The JWT.
-
jwe
@Deprecated public EncryptedJwtBuilder jwe(JwtBuilderFactory jwtbuilder)
Deprecated.Description copied from interface:JwtCryptographyHandler
Apply encryption to the JWT.- Specified by:
jwe
in interfaceJwtCryptographyHandler
- Parameters:
jwtbuilder
- The JWT builder.- Returns:
- The JWT builder after applying encryption.
-
sign
@Deprecated public EncryptedThenSignedJwtBuilder sign(EncryptedJwtBuilder jwtbuilder)
Deprecated.Description copied from interface:JwtCryptographyHandler
Sign the JWT.- Specified by:
sign
in interfaceJwtCryptographyHandler
- Parameters:
jwtbuilder
- The JWT builder.- Returns:
- The JWT builder after signing.
-
buildJwt
public String buildJwt(JwtBuilderFactory jwtBuilderFactory, JwtClaimsSet claimsSet)
Description copied from interface:JwtCryptographyHandler
Builds a JWT with the given claims set. The resulting JWT will be both encrypted and authenticated, either through direct authenticated encryption or a combination of encryption and signing.- Specified by:
buildJwt
in interfaceJwtCryptographyHandler
- Parameters:
jwtBuilderFactory
- the JWT builder factory.claimsSet
- the claims to add to the JWT.- Returns:
- the JWT in Compact Serialization form.
-
decryptAndVerify
public Jwt decryptAndVerify(JwtBuilderFactory jwtBuilderFactory, String jwt)
Description copied from interface:JwtCryptographyHandler
Decrypts and verifies that the JWT is authentic in a single step.- Specified by:
decryptAndVerify
in interfaceJwtCryptographyHandler
- Parameters:
jwtBuilderFactory
- The JWT builder factory.jwt
- the JWT to decrypt and verify.- Returns:
- the decrypted and verified JWT.
-
-