IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

LDAP error code 32


Sujet :

Spring Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    29
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 29
    Par défaut LDAP error code 32
    Salut tout le monde !

    Je tente d'authentifier un utilisateur présent dans LDAP via spring security. Contrairement au topic précédent, il s'agit bien cette fois ci d'un LDAP et non d'Active Directory.

    Quand je remplis le formulaire de login avec les identifiants d'un utilisateur valide (testé avec la connexion via phpldapadmin), l'appli web me renvoie l'erreur suivante :

    Your login attempt was not successful, try again.

    Reason: [LDAP: error code 32 - No Such Object]; nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'ou=users,dc=example,dc=com'

    Voici mes fichiers de conf :

    web.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
             version="2.4">
     
        <display-name>Intranet Sample</display-name>
     
     
     
        <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>
     
        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
     
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                classpath:springConfiguration.xml
                classpath:springSecuritySettings.xml
            </param-value>
        </context-param>
        
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
     
    </web-app>

    springSecuritySettings.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/security"
                 xmlns:beans="http://www.springframework.org/schema/beans"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-2.5.xsd
    http://www.springframework.org/schema/security
    http://www.springframework.org/schema/security/spring-security-3.0.xsd
    http://www.springframework.org/schema/util
    http://www.springframework.org/schema/util/spring-util-2.0.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
     
        <global-method-security pre-post-annotations="enabled">
        </global-method-security>
     
        <http use-expressions="true">
            <intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
            <form-login />
            <http-basic />
            <logout />
        </http>
     
        <authentication-manager>
            <authentication-provider ref='secondLdapProvider' />
        </authentication-manager>
    </beans:beans>

    sprincConfiguration.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:sec="http://www.springframework.org/schema/security"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:p="http://www.springframework.org/schema/p"
           xmlns:util="http://www.springframework.org/schema/util" xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-2.5.xsd
           http://www.springframework.org/schema/security
           http://www.springframework.org/schema/security/spring-security-2.0.1.xsd
           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
     
        <!-- FOR EASIER INJECTION (Not Working) -->
     
        <tx:annotation-driven/>     <!---->
     
        <!--
        <context:component-scan base-package="test.dao"/>
        -->
     
     
     
        <!-- DEFAULT VALUES FOR SYSTEM PROPERTIES -->
        <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="properties">
                <props>
                    <prop key="application.default.property.key">propertyDefalutValue</prop>
                </props>
            </property>
            <property name="systemPropertiesModeName">
                <value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
            </property>
            <property name="ignoreResourceNotFound" value="true"/>
            <property name="locations">
                <list>
                    <value>classpath:config.properties</value>
                    <!-- value>file:${user.home}/application.properties</value-->
                </list>
            </property>
        </bean>
     
        <!-- THE WEB APPLICATION MUST BE DEFINED AS SPRING BEAN -->
     
        <bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
            <constructor-arg index="0" value="ldap://localhost:389/dc=example,dc=com" />
            <property name="userDn" value="cn=borat,ou=users,dc=example,dc=com" />
            <property name="password" value="admin" />
        </bean>
     
     
        <bean id="ldapUserSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
            <constructor-arg index="0" value="ou=users,dc=example,dc=com" />
            <constructor-arg index="1" value="(uid={0})" />
            <constructor-arg index="2" ref="contextSource" />
            <property name="searchSubtree" value="true" />
        </bean>
     
     
        <bean id="secondLdapProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
            <constructor-arg>
                <bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
                    <constructor-arg ref="contextSource" />
                    <property name="userSearch" ref="ldapUserSearch" />
                </bean>
            </constructor-arg>
            <constructor-arg>
                <bean class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
                    <constructor-arg ref="contextSource" />
                    <constructor-arg value="ou=groups,dc=example,dc=com" />
                    <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>
     
    </beans>

    Merci d'avance pour votre aide.

  2. #2
    Membre averti
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    29
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 29
    Par défaut
    Je viens de trouver une source indiquant que le message d'erreur que j'ai provient d'une malformation de l'arborescence.

    http://books.google.fr/books?id=ASye...%20ldap&f=true

    Pourtant je ne cherche pas à créer un objet mais plutôt à le récupérer (si je me base sur ma connaissance - limitée - de LDAP). Il ne s'agit en aucun cas de créer un nouvel utilisateur, mais de vérifier s'il existe. A moins qu'un objet intermédiaire ne soit créé dans l'annuaire lors de la requête, mais ça m'étonnerait.

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Mars 2011
    Messages
    29
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2011
    Messages : 29
    Par défaut
    Je me permets un petit up.

Discussions similaires

  1. Error code 1000000a
    Par ibm.java dans le forum Windows XP
    Réponses: 8
    Dernier message: 04/04/2007, 11h53
  2. Error code too large
    Par afrikha dans le forum NetBeans
    Réponses: 6
    Dernier message: 14/02/2007, 13h33
  3. ORA-00600: internal error code
    Par Elise78 dans le forum Oracle
    Réponses: 6
    Dernier message: 30/01/2007, 14h32
  4. <: internal error code, arguments: !!!
    Par sb1960 dans le forum Oracle
    Réponses: 3
    Dernier message: 12/04/2006, 17h03
  5. [NASM] Critical error (code 5)
    Par fabnet dans le forum Assembleur
    Réponses: 11
    Dernier message: 25/03/2005, 19h51

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo