O'Reilly logo

Hands-On Enterprise Java Microservices with Eclipse MicroProfile by Scott Stark, Antoine Sabot-Durand, Pavol Loffay, Jeff Mesnil, Heiko W. Rupp, Cesar Saavedra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required