[keycloak-user] Extract Subjectid from token in JaxRS Service

Stian Thorgersen stian at redhat.com
Wed Feb 18 08:38:53 EST 2015



----- Original Message -----
> From: "Mike Love" <mike.love at symbiotics.co.za>
> To: keycloak-user at lists.jboss.org
> Sent: Wednesday, February 18, 2015 2:33:14 PM
> Subject: [keycloak-user] Extract Subjectid from token in JaxRS Service
> 
> Hi,
> 
> I am successfully authenticating an AngularJS client calling REST Services.
> 
> The token is validated as expected after login. On calling the REST service,
> the authorization hearer (Bearer token) is available as HTTP Header as
> expected.
> 
> Now, in the REST Service processing I want to extract the UserId (SubjectId)
> so that I can lookup additional information before continuing with
> processing.
> 
> I have seen that the JS adapter has a keycloak object that provides access
> the this information, is there a similar Java helper class to extract this
> information?

You can either use one of our adapters or org.keycloak.RSATokenVerifier.verifyToken

> 
> 
> Regards,
> Mike Love
> 
> 
> ********************************************************************************
> This email and any accompanying attachments may contain confidential and
> proprietary information. This information is private and protected by law
> and, accordingly, if you are not the intended recipient, you are requested
> to delete this entire communication immediately and are notified that any
> disclosure, copying or distribution of or taking any action based on this
> information is prohibited.
> 
> Emails cannot be guaranteed to be secure or free of errors or viruses. The
> sender does not accept any liability or responsibility for any interception,
> corruption, destruction, loss, late arrival or incompleteness of or
> tampering or interference with any of the information contained in this
> email or for its incorrect delivery or non-delivery for whatsoever reason or
> for its effect on any electronic device of the recipient.
> 
> ********************************************************************************
> 
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user


More information about the keycloak-user mailing list