jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java
changeset 43198 7fc878d49203
parent 42338 a60f280f803c
child 43243 a48dab17a356
equal deleted inserted replaced
43197:883675f526b8 43198:7fc878d49203
   416                 filterMatcher = USERNAME_PATTERN.matcher(userFilter);
   416                 filterMatcher = USERNAME_PATTERN.matcher(userFilter);
   417             }
   417             }
   418             constraints = new SearchControls();
   418             constraints = new SearchControls();
   419             constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
   419             constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
   420             constraints.setReturningAttributes(new String[0]); //return no attrs
   420             constraints.setReturningAttributes(new String[0]); //return no attrs
   421             constraints.setReturningObjFlag(true); // to get the full DN
       
   422         }
   421         }
   423 
   422 
   424         authzIdentity = (String)options.get(AUTHZ_IDENTITY);
   423         authzIdentity = (String)options.get(AUTHZ_IDENTITY);
   425         if (authzIdentity != null &&
   424         if (authzIdentity != null &&
   426             authzIdentity.startsWith("{") && authzIdentity.endsWith("}")) {
   425             authzIdentity.startsWith("{") && authzIdentity.endsWith("}")) {
   876 
   875 
   877             // Extract the distinguished name of the user's entry
   876             // Extract the distinguished name of the user's entry
   878             // (Use the first entry if more than one is returned)
   877             // (Use the first entry if more than one is returned)
   879             if (results.hasMore()) {
   878             if (results.hasMore()) {
   880                 SearchResult entry = results.next();
   879                 SearchResult entry = results.next();
   881 
   880                 userDN = entry.getNameInNamespace();
   882                 // %%% - use the SearchResult.getNameInNamespace method
       
   883                 //        available in JDK 1.5 and later.
       
   884                 //        (can remove call to constraints.setReturningObjFlag)
       
   885                 userDN = ((Context)entry.getObject()).getNameInNamespace();
       
   886 
   881 
   887                 if (debug) {
   882                 if (debug) {
   888                     System.out.println("\t\t[LdapLoginModule] found entry: " +
   883                     System.out.println("\t\t[LdapLoginModule] found entry: " +
   889                         userDN);
   884                         userDN);
   890                 }
   885                 }