diff --git a/services/src/main/java/org/keycloak/authentication/authenticators/browser/ScriptBasedAuthenticator.java b/services/src/main/java/org/keycloak/authentication/authenticators/browser/ScriptBasedAuthenticator.java index 6ab290791b..0b400f07ac 100644 --- a/services/src/main/java/org/keycloak/authentication/authenticators/browser/ScriptBasedAuthenticator.java +++ b/services/src/main/java/org/keycloak/authentication/authenticators/browser/ScriptBasedAuthenticator.java @@ -47,6 +47,7 @@ import java.util.Map; *
  • {@code realm} the {@link RealmModel}
  • *
  • {@code user} the current {@link UserModel}
  • *
  • {@code session} the active {@link KeycloakSession}
  • + *
  • {@code clientSession} the current {@link org.keycloak.models.ClientSessionModel}
  • *
  • {@code httpRequest} the current {@link org.jboss.resteasy.spi.HttpRequest}
  • *
  • {@code LOG} a {@link org.jboss.logging.Logger} scoped to {@link ScriptBasedAuthenticator}/li> * @@ -159,6 +160,7 @@ public class ScriptBasedAuthenticator implements Authenticator { bindings.put("user", context.getUser()); bindings.put("session", context.getSession()); bindings.put("httpRequest", context.getHttpRequest()); + bindings.put("clientSession", context.getClientSession()); bindings.put("LOG", LOGGER); }); } diff --git a/services/src/main/resources/scripts/authenticator-template.js b/services/src/main/resources/scripts/authenticator-template.js index 20de702721..f18dfdf0e3 100644 --- a/services/src/main/resources/scripts/authenticator-template.js +++ b/services/src/main/resources/scripts/authenticator-template.js @@ -15,6 +15,7 @@ AuthenticationFlowError = Java.type("org.keycloak.authentication.AuthenticationF * session - current KeycloakSession {@see org.keycloak.models.KeycloakSession} * httpRequest - current HttpRequest {@see org.jboss.resteasy.spi.HttpRequest} * script - current script {@see org.keycloak.models.ScriptModel} + * clientSession - current client session {@see org.keycloak.models.ClientSessionModel} * LOG - current logger {@see org.jboss.logging.Logger} * * You one can extract current http request headers via: