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

Josh smysnk at gmail.com
Mon Jun 2 12:28:18 EDT 2014


Awesome! Easy enough.


On Mon, Jun 2, 2014 at 6:06 AM, Bill Burke <bburke at redhat.com> wrote:

> 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
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20140602/914ae885/attachment-0001.html 


More information about the keycloak-user mailing list