[keycloak-user] How can I access org.keycloak.KeycloakPrincipal without javax.servlet.http.HttpServletRequest

Marek Posolda mposolda at redhat.com
Wed Aug 24 11:58:47 EDT 2016


On 24/08/16 16:18, Stephen More wrote:
> JIRA issue has been created: https://issues.jboss.org/browse/KEYCLOAK-3470
Thanks
>
>
> Yes, I have the ability to add Servlet Filters.
Cool. So then you can do something like in the servlet filter:

KeycloakPrincipal principal  = (KeyclaokPrincipal) 
servletRequest.getPrincipal();
SomeThreadLocalHolder.set(principal);

Marek
>
> On Wed, Aug 24, 2016 at 4:43 AM, Marek Posolda <mposolda at redhat.com 
> <mailto:mposolda at redhat.com>> wrote:
>
>     AFAIK we don't have support for that, but hopefully we can add
>     adapter option, which will add KeycloakPrincipal to threadLocal.
>     Might be useful for frameworks/apps where the access to
>     servletRequest is not possible. Could you create JIRA?
>
>     Which web framework are you using btv? Do you at least have
>     possibility to add servletFilter, which will put the
>     KEycloakPrincipal to threadLocal, so you can access that in your app?
>
>     Marek
>
>
>     On 23/08/16 22:07, Stephen More wrote:
>>     I am familiar with the Apereo CAS Client, that project has an
>>     AssertionThreadLocalFilter that allows one to access the
>>     principal without having direct access to the web tier session.
>>
>>     org.jasig.cas.client.validation.Assertion assertion =
>>     org.jasig.cas.client.util.AssertionHolder.getAssertion();
>>     org.jasig.cas.client.authentication.AttributePrincipal principal
>>     = assertion.getPrincipal();
>>
>>
>>     Does keycloak have a similar function to access the
>>     org.keycloak.KeycloakPrincipal without access to the
>>     HttpServletRequest ?
>>
>>     -Thanks
>>
>>
>>
>>
>>
>>     _______________________________________________
>>     keycloak-user mailing list
>>     keycloak-user at lists.jboss.org <mailto:keycloak-user at lists.jboss.org>
>>     https://lists.jboss.org/mailman/listinfo/keycloak-user
>>     <https://lists.jboss.org/mailman/listinfo/keycloak-user>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160824/909eb577/attachment.html 


More information about the keycloak-user mailing list