Аутентификация Spring Security LDAP не работает - PullRequest
0 голосов
/ 18 октября 2018

Я получаю приведенную ниже ошибку после ввода правильного имени пользователя и пароля.

Ваша попытка входа не удалась, повторите попытку.

Причина:

[LDAP: error code 17 - UNDEFINED_ATTRIBUTE_TYPE: failed for MessageType : COMPARE_REQUEST Message ID : 23 Compare request Entry : 'uid=ram,ou=people,dc=example,dc=com' Attribute description : 'password' Attribute value : '{SHA}d8eWDokN7d67f/LlXjQNLtFwg2g=org.apache.directory.api.ldap.model.message.CompareRequestImpl@29964fa4 ManageDsaITImpl Control Type OID : '2.16.840.1.113730.3.4.2' Criticality : 'false' ' : ERR_266 password not found within the attributeType registry]; nested exception is javax.naming.directory.InvalidAttributeIdentifierException: [LDAP: error code 17 - UNDEFINED_ATTRIBUTE_TYPE: failed for MessageType : COMPARE_REQUEST Message ID : 23 Compare request Entry : 'uid=ram,ou=people,dc=example,dc=com' Attribute description : 'password' Attribute value : '{SHA}d8eWDokN7d67f/LlXjQNLtFwg2g=org.apache.directory.api.ldap.model.message.CompareRequestImpl@29964fa4 ManageDsaITImpl Control Type OID : '2.16.840.1.113730.3.4.2' Criticality : 'false' ' : ERR_266 password not found within the attributeType registry]; remaining name 'uid=ram,ou=people'

Я настроил следующие вещи в spring-security.xml.

<beans:bean class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
    <beans:constructor-arg value="ldap://localhost:10389"/>
    <beans:constructor-arg value="dc=example,dc=com"/>
</beans:bean>

<authentication-manager>
<ldap-authentication-provider user-dn-pattern="uid={0},ou=people">
<password-compare hash="{sha}" password-attribute="userPassword"/>
</ldap-authentication-provider>
</authentication-manager>

Если я ввел неправильное имя пользователя и пароль, я получаю правильное сообщение.Если я ввел правильное имя пользователя и пароль, я получаю сообщение об ошибке выше.

Детали LDAP:

dn: uid=ram,ou=people,dc=example,dc=com objectClass: organizationalPerson objectClass: person objectClass: inetOrgPerson objectClass: top cn: Ram Sam sn: Sam uid: ram userPassword: {SHA}d8eWDokN7d67f/LlXjQNLtFwg2g=

...