[keycloak-user] How to bind keycloak context to jsf session

Andreas Lau andreas.lau at outlook.com
Tue Oct 2 12:28:44 EDT 2018


Hello,

can somebody please explain how I can integrate the keycloak in a jsf application?

I am using the wildfly adapter and I configured the login-config of the web.xml to use keycloak. Everything works fine. But now I'd like to access the access token and further get the id-token inside the SessionContext of some Beans.

Ideally I would like to bind the Information to the Session. So if the user logs out the keycloak session also gets closed and if he logs in the user infos are provided.

I found a project in the keycloak examples

https://github.com/keycloak/keycloak/tree/master/examples/demo-template/third-party-cdi

which seams to fill a User-Object at the beginning of the ServletContext and seems to do a logout in keycloak at its destroying.

I would like to know if this is a proper way to provide the user information in the secured area of the application. I am not quite sure because the log out technically does not mean that the ServeletContext gets destroyed, right?

I'm a bit confused, hopefully somebody can provide some help.

Thanks in advance.


More information about the keycloak-user mailing list