Aem SlingAuthenticationHandler如何与CRXLogin模块对话

Aem SlingAuthenticationHandler如何与CRXLogin模块对话,aem,jackrabbit,jcr,sling,Aem,Jackrabbit,Jcr,Sling,我读到这一点。但是在我无法弄清楚AuthenticationInfo对象是如何传递给CRXLoginModule之后。我对SlingAuthenticationHandler流程的理解如下- SlingAuthenticator调用AuthenticationHandler(CQ默认值为TokenAuthenticationHandler) AuthenticationHandler返回带有用户名和密码的AuthenticationInfo。在SlingAuthenticationHandler

我读到这一点。但是在我无法弄清楚AuthenticationInfo对象是如何传递给CRXLoginModule之后。我对SlingAuthenticationHandler流程的理解如下-

  • SlingAuthenticator调用AuthenticationHandler(CQ默认值为TokenAuthenticationHandler)

  • AuthenticationHandler返回带有用户名和密码的AuthenticationInfo。在SlingAuthenticationHandler的代码中,它只是从TokenUtil.createCredentials(请求、响应、this.repository、用户名、true)发送AuthenticationInfo对象;TokenUtil类的代码表示-

  • adminSession.impersonate(sc)调用org.apache.jackrabbit.core.SessionImpl.impersonate(凭证crd),它再次调用org.apache.jackrabbit.core.RepositoryImpl.login,允许登录并在org.apache.jackrabbit.core.security.authentication.DefaultLoginModule的commit()方法中创建令牌

  • 问题:

    Q1)在执行adminSession.impersonate(sc)时,如何调用CRXLoginModule?哪个类文件对此负责

    问题2)我看到了SlingAuthenticator的代码,但它没有调用javax.jcr.RepositoryFactory或com.day.crx.core.CRXRepositoryFactory。sling如何将AuthenticationInfo对象传递给CRXLoginModule


    请帮助我了解流程。谢谢你的帮助

    简单的答案是,您列出的任何内容都不会与CRXLoginModule交互

    如果您参考链接到的演示文稿,则演示文稿也不会提到CRXLoginModule

    原因是
    com.day.crx.core.crxlogimodule
    是day的自定义
    javax.security.auth.spi.LoginModule
    ,用于在OSGi框架内移动身份验证机制之前与jackrabbit jcr进行交互,这发生在CQ 5.5中

    身份验证处理程序不使用该LoginModule,而是使用jackrabbit提供的默认LoginModule,即您已经识别的
    org.apache.jackrabbit.core.security.Authentication.DefaultLoginModule

    adminSession = repository.loginAdministrative(null);
    
    SimpleCredentials sc = new SimpleCredentials(userId, new char[0]);
    sc.setAttribute(".token", "");
    userSession = adminSession.impersonate(sc);
    
    TokenCredentials tc = new TokenCredentials((String)sc.getAttribute(".token"));
    AuthenticationInfo authInfo = new AuthenticationInfo("TOKEN", userId);
    authInfo.put("user.jcr.credentials", tc);