[jboss-cvs] JBossAS SVN: r58047 - branches/JEE5_TCK/tomcat/src/main/org/jboss/web/tomcat/security
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Nov 2 23:55:36 EST 2006
Author: anil.saldhana at jboss.com
Date: 2006-11-02 23:55:35 -0500 (Thu, 02 Nov 2006)
New Revision: 58047
Modified:
branches/JEE5_TCK/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java
Log:
JBAS-3815:set the metadata in the ctr
Modified: branches/JEE5_TCK/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java
===================================================================
--- branches/JEE5_TCK/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java 2006-11-03 04:54:57 UTC (rev 58046)
+++ branches/JEE5_TCK/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java 2006-11-03 04:55:35 UTC (rev 58047)
@@ -23,6 +23,8 @@
import java.io.IOException;
import java.security.CodeSource;
+import java.util.Map;
+
import javax.security.jacc.PolicyContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -31,6 +33,8 @@
import org.apache.catalina.connector.Response;
import org.apache.catalina.valves.ValveBase;
import org.jboss.logging.Logger;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.security.SecurityRolesAssociation;
/**
* A Valve that sets the JACC context id and HttpServletRequest policy
@@ -49,14 +53,16 @@
private String contextID;
/** The web app deployment code source */
private CodeSource warCS;
+ private WebMetaData metaData;
private boolean trace;
- public JaccContextValve(String contextID, CodeSource cs)
+ public JaccContextValve(WebMetaData wmd, CodeSource cs)
{
- this.contextID = contextID;
+ this.metaData = wmd;
+ this.contextID = metaData.getJaccContextID();
this.warCS = cs;
this.trace = log.isTraceEnabled();
- }
+ }
public void invoke(Request request, Response response)
throws IOException, ServletException
@@ -64,6 +70,12 @@
activeCS.set(warCS);
HttpServletRequest httpRequest = (HttpServletRequest) request.getRequest();
+ //Set the customized rolename-principalset mapping in jboss-app.xml
+ Map principalToRoleSetMap = metaData.getPrincipalVersusRolesMap();
+ SecurityRolesAssociation.setSecurityRoles(principalToRoleSetMap);
+ if(trace)
+ log.trace("MetaData:"+metaData+":principalToRoleSetMap"+principalToRoleSetMap);
+
try
{
// Set the JACC context id
@@ -77,7 +89,7 @@
{
SecurityAssociationActions.clear();
activeCS.set(null);
+ SecurityRolesAssociation.setSecurityRoles(null);
}
- }
-
+ }
}
More information about the jboss-cvs-commits
mailing list