Class JwtHeaders
java.lang.Object
io.helidon.security.jwt.JwtHeaders
Representation of the header section of a JWT.
This can be used to partially parse a token to understand what kind of
processing should be done further, whether
SignedJwt
or EncryptedJwt.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFluent API builder to create JWT Header. -
Method Summary
Modifier and TypeMethodDescriptionAlgorithm claim.audience()Audience claim.static JwtHeaders.Builderbuilder()Create a new builder for header claims.Content type claim.critical()Critical claim.protected static Stringdecode(String base64, Errors.Collector collector, io.helidon.security.jwt.JwtTokenPart tokenPart) Decode a Base64 URL encoded JWT segment.Encryption algorithm claim.Return map of all header claims.headerClaimValue(String claim) Get a claim by its name from header.Create a JSON header object.issuer()Issuer claim.keyId()Key id claim.protected static JsonObjectparseJson(String jsonString, Errors.Collector collector, io.helidon.security.jwt.JwtTokenPart tokenPart) Parse a decoded JWT segment as a JSON object.static JwtHeadersparseToken(String token) Parse a token to retrieve the JWT header.subject()Subject claim.type()Type claim.
-
Method Details
-
builder
Create a new builder for header claims.- Returns:
- a new builder
-
parseToken
Parse a token to retrieve the JWT header. This method only cares about the first section of the token, and ignores the rest (even if not valid). Text before the first dot is considered to be base64 value of the header JSON.- Parameters:
token- token, expected to be JWT (encrypted or signed)- Returns:
- header parsed from the token
- Throws:
JwtException- in case the token is not valid
-
headerJsonObject
-
headerClaimValue
-
algorithm
-
encryption
-
contentType
-
keyId
-
type
-
subject
-
issuer
-
audience
-
critical
-
headerClaimsJson
-
decode
protected static String decode(String base64, Errors.Collector collector, io.helidon.security.jwt.JwtTokenPart tokenPart) Decode a Base64 URL encoded JWT segment.- Parameters:
base64- base64 URL encoded valuecollector- error collectortokenPart- decoded token part- Returns:
- decoded value, or
nullwhen decoding fails
-
parseJson
protected static JsonObject parseJson(String jsonString, Errors.Collector collector, io.helidon.security.jwt.JwtTokenPart tokenPart) Parse a decoded JWT segment as a JSON object.- Parameters:
jsonString- decoded JSON stringcollector- error collectortokenPart- decoded token part- Returns:
- parsed JSON object, or
nullwhen parsing fails
-