使用 Ldap 在 Glassfish 上进行基本身份验证

Basic Authentication on Glassfish using Ldap

我正在开发 Web 服务。目前,我正在使用使用文件的基本身份验证来管理用户。

现在我想使用Basic认证,集成LDAP服务器。我使用 LDAP - Apache Directory Studio 安装并创建了一个 LDAP 服务器。

在 Glassfish 控制台中,我创建了一个新的 ldapRealm。

我的 web.xml 有这个代码:

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>LDAP</realm-name>
</login-config>

现在我想为不同的ldap用户组指定不同的角色。

我怎样才能做到这一点? Web 服务的这个目的有任何教程吗?

是否可以向不同的方法添加注释指定角色,如@RolesAllowed(LDAP Group)?

为了在 Glassfish 中配置领域,请看 To Create an LDAP Realm in the GlassFish Server

关于 Apache Directory Studio,请参阅 Let's create an LDAP user and search for him. You may want to see Setting up an LDAP directory server for Alfresco development