Injection of JWT claim values

The code snippet in this section illustrates the injection of individual JWT claim values. There are several different formats we can use for the injected value. Standard claims support the object subtypes defined in the Claim#getType field and JsonValue subtypes. Custom claim types only support the injection of the JsonValue subtypes.

The following code example illustrates injection of the standard groups and iss claims, along with customString, customInteger, customDouble, and customObject custom claims:

package io.pckt.jwt.rest;import java.util.Set;import javax.annotation.security.DenyAll;import javax.annotation.security.RolesAllowed;import javax.inject.Inject;import javax.json.JsonArray;import javax.json.JsonNumber; ...

Get Hands-On Enterprise Java Microservices with Eclipse MicroProfile now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.