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);
}