简体   繁体   English

使用自定义LoginModule登录Jackrabbit

[英]Logging into Jackrabbit with custom LoginModule

I am trying to write a LoginModule that authenticates users with Jackrabbit repository. 我正在尝试编写一个LoginModule,用Jackrabbit存储库验证用户身份。 However, I want it to check the credentials that are stored in repository itself. 但是,我希望它检查存储在存储库中的凭据。 So the problem is, in my LoginModule I have to connect to the repository again, making it an infinite loop. 所以问题是,在我的LoginModule中,我必须再次连接到存储库,使其成为无限循环。 Is there something I can do about it? 有什么我可以做的吗?

There a 2 basic approaches: 有两种基本方法:

  1. Provide a admin login to the Jackrabbit repository that the LoginModule is configured with so that it will always be able to connect to the repository. 提供对配置了LoginModule的Jackrabbit存储库的管理员登录,以便它始终能够连接到存储库。 When connected as the admin user query the repository with the supplied credentials (for the normal user that is being authenticated) in order to authenticate them. 当以管理员用户身份连接时,使用提供的凭据(对于正在进行身份验证的普通用户)查询存储库,以便对其进行身份验证。

  2. Alternatively have all of the users set up with an Jackrabbit login, so instead of connecting with the Admin login you try to connect with the supplied credentials and if you connect then the user is successfully connected (with this approach I often will do a simple query to double check the connection is valid, eg look up the user's real name in the repository). 或者让所有用户都设置Jackrabbit登录,因此您不必使用管理员登录连接,而是尝试使用提供的凭据进行连接,如果连接,则用户已成功连接(通过这种方法,我经常会进行简单的查询仔细检查连接是否有效,例如在存储库中查找用户的真实姓名)。

In both cases the LoginModule should contain code that connects directly to Jackrabbit and shouldn't require a LoginModule to connect itself to the repository. 在这两种情况下,LoginModule应包含直接连接到Jackrabbit的代码,并且不应要求LoginModule将自身连接到存储库。

In the JeCARS project there is a custom LoginModule (org.jecars.CARS_LoginModule). JeCARS项目中有一个自定义的LoginModule(org.jecars.CARS_LoginModule)。 It uses a hardcoded admin user for the first access, and because the repository can only be accessed by servlet a check at this point is performed to prevent the external use of the admin user. 它使用硬编码的管理员用户进行第一次访问,并且因为只能通过servlet访问存储库,所以执行此时的检查以防止外部使用admin用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM