ClientAuthenticator and UserSessionNote

Hello,

I extended the JWTClientAuthenticator class (Keycloak 18.0.2) and I’m trying to add info in the User Session Note (knowing that I’m using a service account).

public void authenticateClient(ClientAuthentificationFlowContext context) {

context.getSession().getContext().getAuthenticationSession().setUserSessionNote(“key”,“value”);

However AuthenticationSession is systematically null. Do you have an idea ? My approach is wrong ?
Perhaps at this stage of authentication the session is not yet created?

Thank you