incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r900730 - /sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java
Date Tue, 19 Jan 2010 11:33:03 GMT
Author: fmeschbe
Date: Tue Jan 19 11:33:03 2010
New Revision: 900730

URL: http://svn.apache.org/viewvc?rev=900730&view=rev
Log:
SLING-1291 Set the user name from the request credentials as "impersonator" session attribute
upon impersonation.

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=900730&r1=900729&r2=900730&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
Tue Jan 19 11:33:03 2010
@@ -136,6 +136,15 @@
     private static final boolean DEFAULT_ANONYMOUS_ALLOWED = true;
 
     /**
+     * The name of the session attribute which is set if the session created by
+     * the {@link #handleSecurity(HttpServletRequest, HttpServletResponse)}
+     * method is an impersonated session. The value of this attribute is the
+     * name of the primary user authenticated with the credentials extracted
+     * from the request using the authenitcation handler.
+     */
+    private static final String ATTR_IMPERSONATOR = "impersonator";
+
+    /**
      * The name of the request attribute providing the authenticated JCR
      * Session. This is only provided for backwards compatibility and will be
      * removed in a future release.
@@ -781,7 +790,8 @@
         // sudo the session if needed
         final String authUser = session.getUserID();
         if (sudo != null && sudo.length() > 0) {
-            Credentials creds = new SimpleCredentials(sudo, new char[0]);
+            final SimpleCredentials creds = new SimpleCredentials(sudo, new char[0]);
+            creds.setAttribute(ATTR_IMPERSONATOR, authUser);
             session = session.impersonate(creds);
         }
         // invariant: same session or successful impersonation



Mime
View raw message