Package org.forgerock.openig.tools
Class JwtUtil
java.lang.Object
org.forgerock.openig.tools.JwtUtil
Utility methods supporting JWTs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringClaim-set grant_type key - not available in JwtClaimsSetKey.static final StringClaim-set nonce key - not available in JwtClaimsSetKey.static final JsonPointerClaim-set audience JSON pointer.static final JsonPointerClaim-set expiry JSON pointer.static final JsonPointerClaim-set issuer JSON pointer.static final JsonPointerClaim-set nonce JSON pointer.static final JsonPointerClaim-set tokenName JSON pointer.static final StringClaim-set realm key - not available in JwtClaimsSetKey.static final StringClaim-set scope key - not available in JwtClaimsSetKey.static final StringClaim-set token name key - not available in JwtClaimsSetKey. -
Method Summary
Modifier and TypeMethodDescriptiongetCookieJwt(Request request, String name) Get a JWT from a request, with a given cookie name.getFormJwt(Form form, String param) Get the JWT from a request form parameter.getValue(JwtClaimsSet claimsSet, JsonPointer ptr) Return a value from it's well-known location on the OAuth2 authorization JWT.static <T extends Jwt>
TreconstructJwt(String jwt, Class<T> jwtClass) Reconstruct a JWT from a {code String} representation.
-
Field Details
-
GRANT_TYPE
Claim-set grant_type key - not available in JwtClaimsSetKey.- See Also:
-
NONCE
Claim-set nonce key - not available in JwtClaimsSetKey.- See Also:
-
REALM
Claim-set realm key - not available in JwtClaimsSetKey.- See Also:
-
SCOPE
Claim-set scope key - not available in JwtClaimsSetKey.- See Also:
-
TOKEN_NAME
Claim-set token name key - not available in JwtClaimsSetKey.- See Also:
-
PTR_AUD
Claim-set audience JSON pointer. -
PTR_EXP
Claim-set expiry JSON pointer. -
PTR_ISS
Claim-set issuer JSON pointer. -
PTR_NONCE
Claim-set nonce JSON pointer. -
PTR_TOKEN_NAME
Claim-set tokenName JSON pointer.
-
-
Method Details
-
getCookieJwt
Get a JWT from a request, with a given cookie name.- Parameters:
request- The request from which to obtain the JWT.name- The name of the cookie storing the JWT.- Returns:
- Optional JWT
Stringrepresentation
-
getFormJwt
Get the JWT from a request form parameter.- Parameters:
form- The request from which to obtain the JWT.param- The name of the parameter holding the JWT.- Returns:
- a
Promiseof an optionalStringJWT representation
-
reconstructJwt
Reconstruct a JWT from a {code String} representation.- Type Parameters:
T- type ofJWTto construct.- Parameters:
jwt- The JWT String representation.jwtClass- The JWT class type to construct.- Returns:
- JWT} subtype
-
getValue
Return a value from it's well-known location on the OAuth2 authorization JWT.- Parameters:
claimsSet- The JWT claims set.ptr-JsonPointerreferencing claim.- Returns:
- Optional
Stringcontaining value
-