[keycloak-user] Obtaining the KeycloakSecurityContext from a jaxrs / Bearer Only service

Bill Burke bburke at redhat.com
Mon Jun 2 08:06:55 EDT 2014


In beta-1 you can do the following in JAX-RS:

@Context SecurityContext securityContext;

KeycloakPrincipal principal = 
(KeycloakPrincipal)securityContext.getUserPrincipal();



On 6/2/2014 2:40 AM, Josh wrote:
> Hi,
>
> Looking through the examples I see a few client examples obtaining
> a KeycloakSecurityContext from the HttpServletRequest object via
> getAttribute.
>
> ie.
>
> KeycloakSecurityContext session = (KeycloakSecurityContext)
> req.getAttribute(KeycloakSecurityContext.class.getName());
>
> Wondering how this would be done for examples like the
> "database-service" jax-rs example?
>
> My goal is to be able to have access to the IDToken information for a
> rest call.
>
> --
>
> Thanks,
>
> Josh
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com


More information about the keycloak-user mailing list