Package dev.relism.flash.ext.oidc
Class ClaimsHolder
java.lang.Object
dev.relism.flash.ext.oidc.ClaimsHolder
Thread-local store for JWT claims, populated by the OIDC middleware before
the handler runs and cleared in the
finally block afterward.
Safe with virtual threads: each request gets its own virtual thread, so
ThreadLocal values are naturally isolated per request.
// Inside any handler protected by @Authenticated or @RolesAllowed:
// Preferred — typed wrapper:
OidcUser user = ClaimsHolder.user();
String email = user.email();
List<String> roles = user.roles("realm_access.roles");
// Raw escape hatch:
Map<String, Object> all = ClaimsHolder.get();
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns the value of a single claim as a String, ornullif the claim is absent or the request is not authenticated.get()Returns the raw claims map for the current request, ornullif the route is not protected by OIDC middleware.static OidcUseruser()Returns a type-safeOidcUserview of the current request's claims, ornullif the route is not protected by OIDC middleware.
-
Method Details
-
user
Returns a type-safeOidcUserview of the current request's claims, ornullif the route is not protected by OIDC middleware.This is the preferred entry point for both lambda and class-based handlers.
-
get
Returns the raw claims map for the current request, ornullif the route is not protected by OIDC middleware.- See Also:
-
claim
Returns the value of a single claim as a String, ornullif the claim is absent or the request is not authenticated.
-