incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r948706 - /sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java
Date Thu, 27 May 2010 07:44:58 GMT
Author: cziegeler
Date: Thu May 27 07:44:58 2010
New Revision: 948706

URL: http://svn.apache.org/viewvc?rev=948706&view=rev
Log:
Correctly extract user information.

Modified:
    sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java

Modified: sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java?rev=948706&r1=948705&r2=948706&view=diff
==============================================================================
--- sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java
(original)
+++ sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java
Thu May 27 07:44:58 2010
@@ -641,6 +641,18 @@ public class SlingAuthenticator implemen
         }
         return credentials;
     }
+
+    /**
+     * Extract the user name from the authentication info.
+     */
+    private String getUserName(final AuthenticationInfo info) {
+        final Credentials credentials = (Credentials) info.get(AuthenticationInfo.CREDENTIALS);
+        if ( !(credentials instanceof SimpleCredentials) ) {
+            return info.getUser();
+        }
+        return ((SimpleCredentials)credentials).getUserID();
+    }
+
     /**
      * Try to acquire an Session as indicated by authInfo
      *
@@ -700,7 +712,7 @@ public class SlingAuthenticator implemen
             }
 
             // now find a way to get credentials
-            handleLoginFailure(request, response, authInfo.getUser(), re);
+            handleLoginFailure(request, response, getUserName(authInfo), re);
 
         }
 



Mime
View raw message