8161743: Provide proper login context
authorweijun
Fri, 12 Aug 2016 10:20:13 +0800
changeset 43198 7fc878d49203
parent 43197 883675f526b8
child 43199 e7fc78485b36
8161743: Provide proper login context Reviewed-by: ahgross, vinnie, xuelei
jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java	Tue Aug 09 11:41:47 2016 +0100
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java	Fri Aug 12 10:20:13 2016 +0800
@@ -418,7 +418,6 @@
             constraints = new SearchControls();
             constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
             constraints.setReturningAttributes(new String[0]); //return no attrs
-            constraints.setReturningObjFlag(true); // to get the full DN
         }
 
         authzIdentity = (String)options.get(AUTHZ_IDENTITY);
@@ -878,11 +877,7 @@
             // (Use the first entry if more than one is returned)
             if (results.hasMore()) {
                 SearchResult entry = results.next();
-
-                // %%% - use the SearchResult.getNameInNamespace method
-                //        available in JDK 1.5 and later.
-                //        (can remove call to constraints.setReturningObjFlag)
-                userDN = ((Context)entry.getObject()).getNameInNamespace();
+                userDN = entry.getNameInNamespace();
 
                 if (debug) {
                     System.out.println("\t\t[LdapLoginModule] found entry: " +