Set httpSession attribute in a SPI

Hi all, sorry for my poor english.
I’ve created a ResetCredentialChoseUser SPI quite easily . What I need is to set an attribute in httpSession to retrieve in the .ftl page as ${mySessionAttribute}.
How is it possible ?

1 Like

Hi,

Try context.form().setAttribute("mySessionAttribute", "value"); or context.getSession().setAttribute("", ""); and see if this provides the expected output for you.

1 Like

KeycloakSession is a HttpSession? and how do i get it in .ftl file ?

1 Like

It’s just an idea, I don’t have time to test it myself.
Have you tried using ${mySessionAttribute} in your template when setting it with either context.form().setA… or context.getSession().set… ?
You can also clone the Keycloak repo and look through the code on how they fill the template variables but try the examples that I gave you first, if it didn’t work you’ve only lost a minute or gained more.

1 Like

@gionnydeep75 did you find how to do it ?