[jboss-cvs] JBossAS SVN: r112356 - branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/security.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 18 16:27:15 EDT 2011


Author: dehort
Date: 2011-10-18 16:27:13 -0400 (Tue, 18 Oct 2011)
New Revision: 112356

Modified:
   branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java
Log:
Reverting some changes that broke some PicketLink integration tests.
[JBPAPP-7332]


Modified: branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java
===================================================================
--- branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java	2011-10-18 17:13:17 UTC (rev 112355)
+++ branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java	2011-10-18 20:27:13 UTC (rev 112356)
@@ -73,6 +73,7 @@
    { 
       SecurityAssociationValve.activeWebMetaData.set(metaData);
       activeCS.set(warCS);
+      HttpServletRequest httpRequest = (HttpServletRequest) request.getRequest();
 
       //Set the customized rolename-principalset mapping in jboss-app.xml
       Map<String, Set<String>> principalToRoleSetMap = metaData.getPrincipalVersusRolesMap();
@@ -84,15 +85,24 @@
       {
          // Set the JACC context id
          PolicyContext.setContextID(contextID);
+         // Set the JACC HttpServletRequest PolicyContextHandler data
+         HttpServletRequestPolicyContextHandler.setRequest(httpRequest);
+         if(ActiveRequestResponseCacheValve.activeRequest.get() == null)
+        	 ActiveRequestResponseCacheValve.activeRequest.set(request);
+         if(ActiveRequestResponseCacheValve.activeResponse.get() == null)
+        	 ActiveRequestResponseCacheValve.activeResponse.set(response);
          // Perform the request
          getNext().invoke(request, response);
       }
       finally
       {
          SecurityAssociationValve.activeWebMetaData.set(null);
+         ActiveRequestResponseCacheValve.activeRequest.set(null);
+         ActiveRequestResponseCacheValve.activeResponse.set(null);
          SecurityAssociationActions.clear();
          activeCS.set(null);
          SecurityRolesAssociation.setSecurityRoles(null);
+         HttpServletRequestPolicyContextHandler.setRequest(null); 
       }
    }
 
@@ -101,6 +111,7 @@
    {
       SecurityAssociationValve.activeWebMetaData.set(metaData);
       activeCS.set(warCS);
+      HttpServletRequest httpRequest = (HttpServletRequest) request.getRequest();
 
       //Set the customized rolename-principalset mapping in jboss-app.xml
       Map<String, Set<String>> principalToRoleSetMap = metaData.getPrincipalVersusRolesMap();
@@ -112,16 +123,25 @@
       {
          // Set the JACC context id
          PolicyContext.setContextID(contextID);
+         // Set the JACC HttpServletRequest PolicyContextHandler data
+         HttpServletRequestPolicyContextHandler.setRequest(httpRequest);
+         if(ActiveRequestResponseCacheValve.activeRequest.get() == null)
+        	 ActiveRequestResponseCacheValve.activeRequest.set(request);
+         if(ActiveRequestResponseCacheValve.activeResponse.get() == null)
+        	 ActiveRequestResponseCacheValve.activeResponse.set(response);
          // Perform the request
          getNext().event(request, response, event);
       }
       finally
       {
          SecurityAssociationValve.activeWebMetaData.set(null);
+         ActiveRequestResponseCacheValve.activeRequest.set(null);
+         ActiveRequestResponseCacheValve.activeResponse.set(null);
          SecurityAssociationActions.clear();
          activeCS.set(null);
          SecurityRolesAssociation.setSecurityRoles(null);
+         HttpServletRequestPolicyContextHandler.setRequest(null); 
       }
    }
    
-}
+}
\ No newline at end of file



More information about the jboss-cvs-commits mailing list