incubator-sling-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=900732&view=rev
Log:
SLING-1292 logout original session 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=900732&r1=900731&r2=900732&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:37:02 2010
@@ -792,7 +792,12 @@
         if (sudo != null && sudo.length() > 0) {
             final SimpleCredentials creds = new SimpleCredentials(sudo, new char[0]);
             creds.setAttribute(ATTR_IMPERSONATOR, authUser);
-            session = session.impersonate(creds);
+            final Session impersonated = session.impersonate(creds);
+
+            // logout the original session and replace with impersonated
+            // session.
+            session.logout();
+            session = impersonated;
         }
         // invariant: same session or successful impersonation
 



Mime
View raw message