File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,18 @@ Additional Claims defined in the token's Header can be obtained by calling `getH
206206Claim claim = jwt. getHeaderClaim(" owner" );
207207```
208208
209+ When creating a Token with the ` JWT.create() ` you can specify header Claims by calling ` withHeader() ` and passing both the map of claims.
210+
211+ ``` java
212+ Map<String , Object > headerClaims = new HashMap ();
213+ headerclaims. put(" owner" , " auth0" );
214+ JWT . create()
215+ .withHeader(headerClaims)
216+ .sign(Algorithm . HMAC256 (" secret" ));
217+ ```
218+
219+ > The ` alg ` and ` typ ` values will always be included in the Header after the signing process.
220+
209221
210222### Payload Claims
211223
@@ -273,14 +285,14 @@ Additional Claims defined in the token's Payload can be obtained by calling `get
273285Map<String , Claim > claims = jwt. getClaims(); // Key is the Claim name
274286Claim claim = claims. get(" isAdmin" );
275287```
276- al
288+
277289or
278290
279291``` java
280292Claim claim = jwt. getClaim(" isAdmin" );
281293```
282294
283- When creating a Token with the ` JWT.create() ` you can specify a custom Claim by calling ` withClaim() ` and passing both the name and the value.
295+ When creating a Token with the ` JWT.create() ` you can specify a custom Claim by calling ` withClaim() ` and passing both the name and the value.
284296
285297``` java
286298JWT . create()
You can’t perform that action at this time.
0 commit comments