spring-security - Spring Security 和 LDAP MD5 身份验证

标签 spring-security ldap spring-ldap

我需要进行 Spring Security 身份验证,其中使用密码比较以 LDAP MD5 十六进制编码格式存储密码的用户。对于 LDAP SHA 编码,我可以使用 LDAPShaPasswordEncoder。我应该使用哪个编码器进行 LDAP MD5 编码?

最佳答案

<bean id="ldapAuthenticationProvider"
    class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
    <constructor-arg>
        <bean class="org.springframework.security.ldap.authentication.PasswordComparisonAuthenticator">
            <constructor-arg ref="contextSource" />
            <property name="passwordEncoder">
                <bean class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" />
            </property>
            <property name="userDnPatterns">
                <list>
                    <value>uid={0},ou=people</value>
                </list>
            </property>
        </bean>
    </constructor-arg>
    <constructor-arg>
        <bean
            class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
            <constructor-arg ref="contextSource" />
            <constructor-arg value="ou=groups" />
            <property name="groupSearchFilter" value="(member={0})" />
            <property name="rolePrefix" value="ROLE_" />
            <property name="searchSubtree" value="true" />
            <property name="convertToUpperCase" value="true" />
        </bean>
    </constructor-arg>
</bean>

关于spring-security - Spring Security 和 LDAP MD5 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13059100/

相关文章:

typescript - CORS 预检 channel 在 Spring Security 中未成功

java - 使用 Activity 目录的 Spring Security 身份验证失败

ldap - Keycloak 如何使用 User Federation 中定义的 LDAP 属性?

java - Spring LDAP 支持的 LDAP 提供程序列表

spring - 配置2个LDAP服务器

java - jackson 不匹配输入异常 : No content to map due to end-of-input

java - AuthenticationProvider authenticate 在 IE 中调用两次,登录失败

java.lang.NoClassDefFoundError : org/springframework/security/authentication/AuthenticationManager 错误

java - 适用于 BlackBerry 的 LDAP 库不错吗?

annotations - Spring LDAP PoolingContextSource 通过注解