0

目前,我正在使用 Spring Security 对 LDAP 服务器进行身份验证。这实际上是一个 Active Directory,因此用户必须输入他们的 Windows 用户名和密码才能登录 Windows,然后输入相同的用户名和密码才能登录此应用程序。这让我的用户发疯了。

如果浏览器提供它们,是否有办法指示 Spring 使用 Windows 的凭据,否则显示登录表单?

这是我目前的配置:

<security:http auto-config="true" use-expressions="true">
    <security:intercept-url pattern="/admin/**"
        access="hasRole('ADMIN')" />
    <security:intercept-url pattern="/**"
        access="isAuthenticated()" />
</security:http>

<security:ldap-server id="ldapServer"
    url="ldap://ldapserver:389/OU=Users,OU=Prod,DC=hhh,DC=org"
    manager-dn="xxx@hhh.org" manager-password="xxx" />
<security:authentication-manager alias="ldapAuthenticationManager">
    <security:ldap-authentication-provider user-context-mapper-ref="userContextMapper"
        user-search-filter="(sAMAccountName={0})"/>
</security:authentication-manager>

其中 userContextMapper 是我为加载用户实体而实现的类。

4

0 回答 0