[jboss-cvs] JBossAS SVN: r86067 - projects/security/security-jboss-sx/trunk/jbosssx/src/main/java/org/jboss/security/plugins.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 18 15:26:39 EDT 2009
Author: anil.saldhana at jboss.com
Date: 2009-03-18 15:26:39 -0400 (Wed, 18 Mar 2009)
New Revision: 86067
Modified:
projects/security/security-jboss-sx/trunk/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java
Log:
SECURITY-386: PolicyRegistration new method to register a config object model
Modified: projects/security/security-jboss-sx/trunk/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java 2009-03-18 19:26:05 UTC (rev 86066)
+++ projects/security/security-jboss-sx/trunk/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java 2009-03-18 19:26:39 UTC (rev 86067)
@@ -29,6 +29,8 @@
import java.util.Map;
import java.util.Set;
+import javax.xml.bind.JAXBElement;
+
import org.jboss.logging.Logger;
import org.jboss.security.acl.ACL;
import org.jboss.security.acl.ACLImpl;
@@ -185,6 +187,46 @@
}
/**
+ * @see PolicyRegistration#registerPolicyConfig(String, String, Object)
+ */
+ public <P> void registerPolicyConfig(String contextId, String type, P objectModel)
+ {
+ if (PolicyRegistration.XACML.equalsIgnoreCase(type))
+ {
+ if(objectModel instanceof JAXBElement == false)
+ throw new IllegalArgumentException("Unsupported model:" + objectModel);
+
+ try
+ {
+ JAXBElement<?> jaxbModel = (JAXBElement<?>) objectModel;
+ JBossPDP pdp = new JBossPDP(jaxbModel);
+ this.contextIDToJBossPDP.put(contextId, pdp);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ else if (PolicyRegistration.ACL.equalsIgnoreCase(type))
+ {
+ if(objectModel instanceof ACLConfiguration == false)
+ throw new IllegalArgumentException("Unsupported model:" + objectModel);
+
+ ACLConfiguration configuration = (ACLConfiguration) objectModel;
+ Set<ACL> configuredACLs = configuration.getConfiguredACLs();
+ // register the configured ACLs
+ this.contextIDToACLs.put(contextId, configuredACLs);
+ for (ACL acl : configuredACLs)
+ {
+ ACLImpl impl = (ACLImpl) acl;
+ if (trace)
+ log.trace("Registering ACL for resource " + impl.getResourceAsString());
+ this.configuredACLs.put(impl.getResourceAsString(), acl);
+ }
+ }
+ }
+
+ /**
* @see PolicyRegistration#registerPolicyConfigFile(String, String, InputStream)
*/
public void registerPolicyConfigFile(String contextId, String type, InputStream stream)
More information about the jboss-cvs-commits
mailing list