BenjaminFavre / keycloak-apple-social-identity-provider

Apple Social Identity Provider for Keycloak
Apache License 2.0
108 stars 53 forks source link

Passing data to ftl file #39

Open htaimoor2010 opened 8 months ago

htaimoor2010 commented 8 months ago

Hi, I am integrating keycloak with my app. Due to some reason, I have to pass some custom parameters from query params to the register.ftl file. I have written a custom authenticator and have added it start of the registration flow so that I can access it before the register page is rendered. I have successfully extracted query param and now I want to use it in my register.ftl file.

I have added it in session attribute in authenticate method of my custom authenticator like this context.getSession().setAttribute("patient_code","54321"); //for testing And then tried to access it in ftl file like this:

Patient Code: ${attribute.patient_code}

But it is not working and I get error when register.ftl page is being rendered. The user is not created yet so cant use user attributes. I tried using context.getAuthenticationSession().setAuthNote but it didnt work either.

Is there any way I can achieve this? I may need to add some custom logic in authenticator and based on that, pass params to ftl, so I want to achieve it by passing from authenticator to ftl.