Keycloak keydape:获取当前SSO会话的UserSessionModel

Keycloak keydape:获取当前SSO会话的UserSessionModel,keycloak,authenticator,Keycloak,Authenticator,钥匙斗篷11.0.2 是否有方法在自定义验证器中获取分配给当前SSO会话的UserSessionModel 我可以选择一个列表: } 因此,如果有人知道另一种方法来记录UserSessionNotesw/oUserSessionModel,这也将是一个解决方案。我在Keyclope论坛上收到了答案 要在验证器中获取当前SSO的UserSessionModel: @Override public void authenticate(AuthenticationFlowContext context

钥匙斗篷11.0.2

  • 是否有方法在自定义验证器中获取分配给当前SSO会话的
    UserSessionModel
  • 我可以选择一个
    列表

    }


    因此,如果有人知道另一种方法来记录
    UserSessionNotes
    w/o
    UserSessionModel
    ,这也将是一个解决方案。

    我在Keyclope论坛上收到了答案

    要在验证器中获取当前SSO的
    UserSessionModel

    @Override
    public void authenticate(AuthenticationFlowContext context) {
        UserSessionModel userSessionModel;
        AuthenticationManager.AuthResult authResult = AuthenticationManager.authenticateIdentityCookie(context.getSession(),
                context.getRealm(), true);
        if (authResult != null) {
            // That is it:
            userSessionModel = authResult.getSession();
        }
    

    我在Keyclope论坛上收到了答案

    要在验证器中获取当前SSO的
    UserSessionModel

    @Override
    public void authenticate(AuthenticationFlowContext context) {
        UserSessionModel userSessionModel;
        AuthenticationManager.AuthResult authResult = AuthenticationManager.authenticateIdentityCookie(context.getSession(),
                context.getRealm(), true);
        if (authResult != null) {
            // That is it:
            userSessionModel = authResult.getSession();
        }
    
    @Override
    public void authenticate(AuthenticationFlowContext context) {
        UserSessionModel userSessionModel;
        AuthenticationManager.AuthResult authResult = AuthenticationManager.authenticateIdentityCookie(context.getSession(),
                context.getRealm(), true);
        if (authResult != null) {
            // That is it:
            userSessionModel = authResult.getSession();
        }