我读到了这一点here .但是在我无法弄清楚 AuthenticationInfo 对象是如何传递给 CRXLoginModule 之后。我所了解的 SlingAuthenticationHandler 流程如下 -
SlingAuthenticator调用AuthenticationHandler(CQ默认为TokenAuthenticationHandler)
AuthenticationHandler 返回带有用户名和密码的 AuthenticationInfo。在 SlingAuthenticationHandler 的代码中,它只是从 TokenUtil.createCredentials(request, response, this.repository, username, true) 发送 AuthenticationInfo 对象; TokenUtil 类的代码说 -
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);
adminSession.impersonate(sc) 调用 org.apache.jackrabbit.core.SessionImpl.impersonate(Credential crd) 再次调用 org.apache.jackrabbit.core.RepositoryImpl.login 并允许登录并创建 token 在 org.apache.jackrabbit.core.security.authentication.DefaultLoginModule 的 commit() 方法中。
问题:
Q1) 执行adminSession.impersonate(sc)时CRXLoginModule是如何调用的?哪个类文件对此负责?
Q2) 我看到了 SlingAuthenticator 的代码,但它没有调用 javax.jcr.RepositoryFactory 或 com.day.crx.core.CRXRepositoryFactory。 sling 如何将 AuthenticationInfo 对象传递给 CRXLoginModule?
请帮助我理解流程。感谢您的帮助!
最佳答案
简单的答案是,您列出的任何内容都不会与 CRXLoginModule 交互。
如果您引用链接到的演示文稿,该演示文稿也没有提到 CRXLoginModule。
原因是 com.day.crx.core.CRXLoginModule
是 Day 的自定义 javax.security.auth.spi.LoginModule
,用于与在 CQ 5.5 中移动身份验证机制之前的 jackrabbit jcr
身份验证处理程序使用 jackrabbit 提供的默认登录模块,而不是使用该登录模块,这将是您已经确定的 org.apache.jackrabbit.core.security.authentication.DefaultLoginModule
关于aem - SlingAuthenticationHandler 如何与 CRXLogin 模块对话,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23907174/