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
Modifier and TypeClassDescriptionstatic class
Fluent API builder to create JWT Header. -
Method Summary
Modifier and TypeMethodDescriptionAlgorithm claim.audience()
Audience claim.static JwtHeaders.Builder
builder()
Create a new builder for header claims.Content type claim.critical()
Critical claim.protected static String
decode
(String base64, Errors.Collector collector, String description) Encryption algorithm claim.headerClaim
(String claim) Get a claim by its name from header.Return map of all header claims.Create a JSON header object.issuer()
Issuer claim.keyId()
Key id claim.protected static JsonObject
parseJson
(String jsonString, Errors.Collector collector, String base64, String description) static JwtHeaders
parseToken
(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
-
headerJson
Create a JSON header object.- Returns:
- JsonObject for header
-
headerClaim
Get a claim by its name from header.- Parameters:
claim
- name of a claim- Returns:
- claim value if present
-
algorithm
Algorithm claim.- Returns:
- algorithm or empty if claim is not defined
-
encryption
Encryption algorithm claim.- Returns:
- algorithm or empty if not encrypted
-
contentType
Content type claim.- Returns:
- content type or empty if claim is not defined
-
keyId
Key id claim.- Returns:
- key id or empty if claim is not defined
-
type
Type claim.- Returns:
- type or empty if claim is not defined
-
subject
Subject claim.- Returns:
- subject or empty if claim is not defined
-
issuer
Issuer claim.- Returns:
- Issuer or empty if claim is not defined
-
audience
Audience claim.- Returns:
- audience or empty optional if claim is not defined; list would be empty if the audience claim is defined as an empty array
-
critical
Critical claim.- Returns:
- critical claims or empty optional if not defined; list would be empty if the critical claim is defined as an empty array
-
headerClaims
Return map of all header claims.- Returns:
- header claims
-
decode
-
parseJson
protected static JsonObject parseJson(String jsonString, Errors.Collector collector, String base64, String description)
-