Package org.forgerock.json.jose.common
Class JwtReconstruction
- java.lang.Object
-
- org.forgerock.json.jose.common.JwtReconstruction
-
public class JwtReconstruction extends Object
A service that provides a method for reconstruct a JWT string back into its relevant JWT object, (SignedJwt
,EncryptedJwt
,SignedThenEncryptedJwt
,EncryptedThenSignedJwt
).- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description JwtReconstruction()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JwtReconstruction
recognizedHeaders(String... headers)
Configures additional application-specific header values that are understood and processed by the application.<T extends Jwt>
TreconstructJwt(String jwtString, Class<T> jwtClass)
Reconstructs the given JWT string into a JWT object of the specified type.
-
-
-
Method Detail
-
recognizedHeaders
public JwtReconstruction recognizedHeaders(String... headers)
Configures additional application-specific header values that are understood and processed by the application. Any non-standard critical headers that are not in this list will cause processing to fail.- Parameters:
headers
- the set of headers to add to the recognized set.- Returns:
- the updated JwtReconstruction object.
-
reconstructJwt
public <T extends Jwt> T reconstructJwt(String jwtString, Class<T> jwtClass)
Reconstructs the given JWT string into a JWT object of the specified type.- Type Parameters:
T
- The type of JWT the JWT string represents.- Parameters:
jwtString
- The JWT string.jwtClass
- The JWT class to reconstruct the JWT string to.- Returns:
- The reconstructed JWT object.
- Throws:
InvalidJwtException
- If the jwt does not consist of the correct number of parts or is malformed.JwtReconstructionException
- If the jwt does not consist of the correct number of parts.UnrecognizedCriticalHeaderException
- If the JWT contains critical headers ("crit") that are not recognized by the application.
-
-