[jboss-cvs] JBossAS SVN: r64060 - in projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml: factories and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 16 00:55:57 EDT 2007
Author: anil.saldhana at jboss.com
Date: 2007-07-16 00:55:57 -0400 (Mon, 16 Jul 2007)
New Revision: 64060
Added:
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/SecurityActions.java
Modified:
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java
projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java
Log:
Use privileged blocks
Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java 2007-07-14 11:53:01 UTC (rev 64059)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/JBossPDP.java 2007-07-16 04:55:57 UTC (rev 64060)
@@ -50,7 +50,6 @@
import org.jboss.security.xacml.jaxb.PoliciesType;
import org.jboss.security.xacml.jaxb.PolicySetType;
import org.jboss.security.xacml.jaxb.PolicyType;
-import org.jboss.security.xacml.locators.JBossPolicySetLocator;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
@@ -223,7 +222,7 @@
JAXBContext jc = JAXBContext.newInstance( "org.jboss.security.xacml.jaxb" ); ;
unmarshaller = jc.createUnmarshaller();
//Validate against schema
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
URL schemaURL = tcl.getResource("schema/jbossxacml-2.0.xsd");
SchemaFactory scFact = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = scFact.newSchema(schemaURL);
@@ -249,7 +248,7 @@
}
if(is == null)
{
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
is = tcl.getResourceAsStream(loc);
}
return is;
@@ -257,7 +256,7 @@
private Class loadClass(String fqn) throws Exception
{
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
return tcl.loadClass(fqn);
}
}
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/SecurityActions.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/SecurityActions.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/core/SecurityActions.java 2007-07-16 04:55:57 UTC (rev 64060)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.security.xacml.core;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+//$Id$
+
+/**
+ * Privileged Blocks
+ * @author Anil.Saldhana at redhat.com
+ * @since Jul 10, 2007
+ * @version $Revision$
+ */
+public class SecurityActions
+{
+ public static ClassLoader getContextClassLoader()
+ {
+ return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+}
Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java 2007-07-14 11:53:01 UTC (rev 64059)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/org/jboss/security/xacml/factories/PolicyFactory.java 2007-07-16 04:55:57 UTC (rev 64060)
@@ -25,6 +25,7 @@
import java.lang.reflect.Constructor;
import org.jboss.security.xacml.core.JBossXACMLPolicy;
+import org.jboss.security.xacml.core.SecurityActions;
import org.jboss.security.xacml.interfaces.XACMLPolicy;
import com.sun.xacml.finder.PolicyFinder;
@@ -51,7 +52,7 @@
public static void setConstructingClass(String fqn)
{
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
try
{
setConstructingClass(tcl.loadClass(fqn));
More information about the jboss-cvs-commits
mailing list