[jboss-cvs] Picketbox SVN: r128 - in trunk: picketbox/src/test/java/org/picketbox/test/api and 35 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 28 16:57:56 EDT 2010
Author: sguilhen at redhat.com
Date: 2010-09-28 16:57:54 -0400 (Tue, 28 Sep 2010)
New Revision: 128
Removed:
trunk/picketbox/src/test/java/org/picketbox/test/api/InstanceBasedAuthorizationUnitTestCase.java
trunk/security-jboss-sx/jbosssx-mc-int/
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLBaseDefinition.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParser.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserJBossXB.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserStax.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfiguration.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigurationFactory.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLDefinition.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLEntryHolder.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLInfoContainer.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLProviderEntryHolder.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/SecurityActions.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/audit/config/AuditConfigEntryHolder.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/config/AuthModuleEntryHolder.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/AppConfigurationEntryHolder.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/AuthenticationInfoContainer.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/JBossXBParsingUtil.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginConfigObjectModelFactory.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginModuleStackContainer.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/ModuleOptionContainer.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersObjectModelFactory.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/AuthorizationInfoContainer.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/config/AuthorizationConfigEntryHolder.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/config/SecurityConfigObjectModelFactory.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicyContainer.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/identitytrust/config/IdentityTrustConfigEntryHolder.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/config/MappingConfigContainer.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/config/MappingConfigEntryHolder.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/acl/
trunk/security-jboss-sx/jbosssx/src/main/resources/schema/jboss-acl-config_1_0.xsd
trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/acl/config/
trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authorization/acl/
trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/security/config/JBossXBSchemaBindingUnitTestCase.java
trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/security/config/SecurityConfigurationUnitTestCase.java
trunk/security-jboss-sx/jbosssx/src/test/resources/config/jboss-acl.xml
trunk/security-spi/acl/src/main/java/org/jboss/security/acl/ACLContext.java
Modified:
trunk/picketbox/src/main/java/org/picketbox/core/authorization/resources/POJOResource.java
trunk/security-jboss-sx/acl/pom.xml
trunk/security-jboss-sx/assembly/pom.xml
trunk/security-jboss-sx/identity/pom.xml
trunk/security-jboss-sx/jbosssx-client/pom.xml
trunk/security-jboss-sx/jbosssx/pom.xml
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/XMLLoginConfigImpl.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationJASPIConfigParser.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/IdentityTrustConfigParser.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java
trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authentication/jaspi/AuthContextUnitTestCase.java
trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authorization/AuthorizationContextUnitTestCase.java
trunk/security-jboss-sx/parent/pom.xml
trunk/security-jboss-sx/pom.xml
trunk/security-spi/acl/pom.xml
trunk/security-spi/assembly/pom.xml
trunk/security-spi/authorization/pom.xml
trunk/security-spi/authorization/src/main/java/org/jboss/security/AuthorizationManager.java
trunk/security-spi/authorization/src/main/java/org/jboss/security/authorization/PolicyRegistration.java
trunk/security-spi/identity/pom.xml
trunk/security-spi/parent/pom.xml
trunk/security-spi/pom.xml
trunk/security-spi/spi/pom.xml
Log:
SECURITY-534: removed MC integration and the JBossXB dependency. Stax is now used to parse XML configuration files.
Modified: trunk/picketbox/src/main/java/org/picketbox/core/authorization/resources/POJOResource.java
===================================================================
--- trunk/picketbox/src/main/java/org/picketbox/core/authorization/resources/POJOResource.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/picketbox/src/main/java/org/picketbox/core/authorization/resources/POJOResource.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -63,5 +63,5 @@
public void add(String key, Object value)
{
map.put(key, value);
- }
+ }
}
\ No newline at end of file
Deleted: trunk/picketbox/src/test/java/org/picketbox/test/api/InstanceBasedAuthorizationUnitTestCase.java
===================================================================
--- trunk/picketbox/src/test/java/org/picketbox/test/api/InstanceBasedAuthorizationUnitTestCase.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/picketbox/src/test/java/org/picketbox/test/api/InstanceBasedAuthorizationUnitTestCase.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,383 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.picketbox.test.api;
-
-import java.net.URI;
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.security.auth.Subject;
-
-import junit.framework.TestCase;
-
-import org.jboss.security.AuthenticationManager;
-import org.jboss.security.AuthorizationManager;
-import org.jboss.security.acl.ACLEntry;
-import org.jboss.security.acl.ACLEntryImpl;
-import org.jboss.security.acl.ACLPersistenceStrategy;
-import org.jboss.security.acl.BasicACLPermission;
-import org.jboss.security.acl.BitMaskPermission;
-import org.jboss.security.acl.CompositeACLPermission;
-import org.jboss.security.acl.EntitlementEntry;
-import org.jboss.security.authorization.AuthorizationContext;
-import org.jboss.security.authorization.Resource;
-import org.jboss.security.authorization.ResourceKeys;
-import org.jboss.security.authorization.ResourceType;
-import org.jboss.security.identity.plugins.IdentityFactory;
-import org.picketbox.config.PicketBoxConfiguration;
-import org.picketbox.factories.SecurityFactory;
-import org.picketbox.test.acl.MemoryOnlyACLStrategy;
-
-/**
- * <p>
- * This {@code TestCase} tests the behavior of the instance-based authorization mechanism (ACLs). All tests use a
- * memory-based {@code ACLPersistenceStrategy} implementation. Real world scenarios will most likely require an
- * implementation that stores the ACLs on the file systems or databases.
- * </p>
- *
- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- */
-public class InstanceBasedAuthorizationUnitTestCase extends TestCase
-{
- private final String securityDomainName = "test";
-
- private final String configFile = "config/acl-authorization.conf";
-
- private final Resource importantResource1 = new TestResource("file://documents/project/important-file1");
-
- private final Resource importantResource2 = new TestResource("file://documents/project/important-file2");
-
- private boolean initialized;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- // setup the static test ACLs only once.
- if (!this.initialized)
- {
- ACLPersistenceStrategy strategy = new MemoryOnlyACLStrategy();
-
- // create an ACL for important-file1.
- // project managers may read, update and delete the file.
- ACLEntry entry1 = new ACLEntryImpl(new CompositeACLPermission(BasicACLPermission.values()), "manager");
- // project developers can only view the contents of the file.
- ACLEntry entry2 = new ACLEntryImpl(BasicACLPermission.READ, "developer");
- Collection<ACLEntry> entries = new ArrayList<ACLEntry>();
- entries.add(entry1);
- entries.add(entry2);
- // create and register the ACLs in the persistence strategy.
- strategy.createACL(this.importantResource1, entries);
-
- // we won't create an ACL for important-file2 - we will make it a child resource of important-file1.
- Collection<Resource> children = new ArrayList<Resource>();
- children.add(importantResource2);
- this.importantResource2.getMap().put(ResourceKeys.PARENT_RESOURCE, this.importantResource1);
- this.importantResource1.getMap().put(ResourceKeys.CHILD_RESOURCES, children);
- this.initialized = true;
- }
- }
-
- /**
- * <p>
- * This test verifies if the instance-based authorization mechanism correctly grants/denies access to a resource
- * according to the permissions that have been specified in the resource's ACL (importantResource1).
- * </p>
- *
- * @throws Exception if an error occurs while running the test.
- */
- public void testAuthorizationBasedOnResourceACL() throws Exception
- {
- SecurityFactory.prepare();
- try
- {
- PicketBoxConfiguration idtrustConfig = new PicketBoxConfiguration();
- idtrustConfig.load(configFile);
-
- AuthenticationManager authManager = SecurityFactory.getAuthenticationManager(securityDomainName);
- assertNotNull(authManager);
-
- // bob, the project manager authenticates to the system.
- Subject subject = new Subject();
- boolean result = authManager.isValid(this.getPrincipal("bob"), "bobpass", subject);
- assertTrue("Unexpected authentication error", result);
-
- // now bob wants to update the important project file. We must check if he has permission to do so.
- AuthorizationManager authzManager = SecurityFactory.getAuthorizationManager(securityDomainName);
- assertNotNull(authzManager);
-
- // first we get bob's roles from the subject (the ACL entries have roles as keys).
- Group roles = subject.getPrincipals(Group.class).iterator().next();
- assertEquals("Unexpected group name", "Roles", roles.getName());
- Enumeration<?> rolesEnum = roles.members();
-
- // now we must check if any of bob's roles has the permission to update the file.
- int decision = AuthorizationContext.DENY;
- while (rolesEnum.hasMoreElements() && decision == AuthorizationContext.DENY)
- {
- Principal role = (Principal) rolesEnum.nextElement();
- decision = authzManager.authorize(this.importantResource1, IdentityFactory.createIdentity(role.getName()),
- BasicACLPermission.UPDATE);
- }
- // as we know, bob is a manager, so the final decision should allow him to update the project file.
- assertEquals("Unexpected authorization decision", AuthorizationContext.PERMIT, decision);
-
- // now alice, the project developer, authenticates to the system.
- subject = new Subject();
- result = authManager.isValid(this.getPrincipal("alice"), "alicepass", subject);
- assertTrue("Unexpected authentication error", result);
-
- // alice tries to delete the important project file. We must check if she has sufficient permissions.
- // first we get alice's roles from the subject.
- roles = subject.getPrincipals(Group.class).iterator().next();
- assertEquals("Unexpected group name", "Roles", roles.getName());
- rolesEnum = roles.members();
-
- // then we check if any of alice's roles has the permission to delete the file.
- decision = AuthorizationContext.DENY;
- while (rolesEnum.hasMoreElements() && decision == AuthorizationContext.DENY)
- {
- Principal role = (Principal) rolesEnum.nextElement();
- decision = authzManager.authorize(this.importantResource1, IdentityFactory.createIdentity(role.getName()),
- BasicACLPermission.DELETE);
- }
- // as we know, alice is only a developer, so the final decision should prevent her from deleting the file.
- assertEquals("Unexpected authorization decision", AuthorizationContext.DENY, decision);
- }
- finally
- {
- SecurityFactory.release();
- }
- }
-
- /**
- * <p>
- * This test verifies if access to {@code important-file2} is granted/denied based on the permissions specified
- * on its parent resource ACL. In other words, we haven't specified an ACL for {@code important-file2} but
- * we made this resource a child of {@code important-file1}, so we expect the ACL of the parent resource
- * ({@code important-file1}) to be used to perform the authorization check.
- * </p>
- *
- * @throws Exception if an error occurs while running the test.
- */
- public void testAuthorizationBasedOnParentResourceACL() throws Exception
- {
- SecurityFactory.prepare();
- try
- {
- PicketBoxConfiguration idtrustConfig = new PicketBoxConfiguration();
- idtrustConfig.load(configFile);
-
- AuthenticationManager authManager = SecurityFactory.getAuthenticationManager(securityDomainName);
- assertNotNull(authManager);
-
- // bob, the project manager authenticates to the system.
- Subject subject = new Subject();
- boolean result = authManager.isValid(this.getPrincipal("bob"), "bobpass", subject);
- assertTrue("Unexpected authentication error", result);
-
- // now bob wants to update the important-file2. We must check if he has permission to do so.
- AuthorizationManager authzManager = SecurityFactory.getAuthorizationManager(securityDomainName);
- assertNotNull(authzManager);
-
- // first we get bob's roles from the subject (the ACL entries have roles as keys).
- Group roles = subject.getPrincipals(Group.class).iterator().next();
- assertEquals("Unexpected group name", "Roles", roles.getName());
- Enumeration<?> rolesEnum = roles.members();
-
- // now we must check if any of bob's roles has the permission to update the file.
- int decision = AuthorizationContext.DENY;
- while (rolesEnum.hasMoreElements() && decision == AuthorizationContext.DENY)
- {
- Principal role = (Principal) rolesEnum.nextElement();
- decision = authzManager.authorize(this.importantResource2, IdentityFactory.createIdentity(role.getName()),
- BasicACLPermission.UPDATE);
- }
- // as we know, bob is a manager, so the final decision should allow him to update the project file.
- // this has been specified in the parent resource (important-file1) ACL.
- assertEquals("Unexpected authorization decision", AuthorizationContext.PERMIT, decision);
-
- // now alice, the project developer, authenticates to the system.
- subject = new Subject();
- result = authManager.isValid(this.getPrincipal("alice"), "alicepass", subject);
- assertTrue("Unexpected authentication error", result);
-
- // alice tries to delete the important-file2. We must check if she has sufficient permissions.
- // first we get alice's roles from the subject.
- roles = subject.getPrincipals(Group.class).iterator().next();
- assertEquals("Unexpected group name", "Roles", roles.getName());
- rolesEnum = roles.members();
-
- // then we check if any of alice's roles has the permission to delete the file.
- decision = AuthorizationContext.DENY;
- while (rolesEnum.hasMoreElements() && decision == AuthorizationContext.DENY)
- {
- Principal role = (Principal) rolesEnum.nextElement();
- decision = authzManager.authorize(this.importantResource2, IdentityFactory.createIdentity(role.getName()),
- BasicACLPermission.DELETE);
- }
- // as we know, alice is only a developer, so the final decision should prevent her from deleting the file.
- assertEquals("Unexpected authorization decision", AuthorizationContext.DENY, decision);
- }
- finally
- {
- SecurityFactory.release();
- }
- }
-
- /**
- * <p>
- * This test verifies if the {@code ACLProvider#getEntitlements()} method returns the expected set of entries.
- * </p>
- *
- * @throws Exception if an error occurs while running the test.
- */
- public void testGetEntitlements() throws Exception
- {
- SecurityFactory.prepare();
- try
- {
- PicketBoxConfiguration idtrustConfig = new PicketBoxConfiguration();
- idtrustConfig.load(configFile);
-
- // get all the permissions assigned to managers on important-file1 and all its child resources.
- AuthorizationManager authzManager = SecurityFactory.getAuthorizationManager(securityDomainName);
- assertNotNull(authzManager);
-
- Set<EntitlementEntry> entries = authzManager.getEntitlements(EntitlementEntry.class,
- this.importantResource1, IdentityFactory.createIdentity("manager")).getEntitled();
- assertNotNull("Unexpected null entitlement entry set", entries);
- assertEquals("Unexpected number of entitlement entries", 2, entries.size());
-
- // check if each entry corresponds to each one of the important files and that managers have all permissions.
- boolean validatedImportantFile1Entry = false;
- boolean validatedImportantFile2Entry = false;
- for(EntitlementEntry entry : entries)
- {
- if (entry.getResource().equals(this.importantResource1))
- validatedImportantFile1Entry = true;
- else if (entry.getResource().equals(this.importantResource2))
- validatedImportantFile2Entry = true;
- else
- fail("Unexpected resource found in entitlement entry set");
- // validate the permissions assigned to the manager role.
- BitMaskPermission permission = (BitMaskPermission) entry.getPermission();
- BitMaskPermission expectedPermission = new CompositeACLPermission(BasicACLPermission.values());
- assertEquals("Unexpected permissions found in entry", expectedPermission.getMaskValue(),
- permission.getMaskValue());
- }
- assertTrue("Important file 1 entry is missing", validatedImportantFile1Entry);
- assertTrue("Important file 2 entry is missing", validatedImportantFile2Entry);
-
- // now get the entitlements entries for the developer role on important-file2.
- entries = authzManager.getEntitlements(EntitlementEntry.class,
- this.importantResource2, IdentityFactory.createIdentity("developer")).getEntitled();
- assertNotNull("Unexpected null entitlement entry set", entries);
- assertEquals("Unexpected number of entitlement entries", 1, entries.size());
-
- // the single entry must contain the important-file2 resource and the READ permission.
- EntitlementEntry entry = entries.iterator().next();
- assertEquals("Unexpected resource found in entry", this.importantResource2, entry.getResource());
- BitMaskPermission permission = (BitMaskPermission) entry.getPermission();
- assertEquals("Unexpected permissions found in entry", BasicACLPermission.READ.getMaskValue(),
- permission.getMaskValue());
- }
- finally
- {
- SecurityFactory.release();
- }
-
- }
-
- private Principal getPrincipal(final String name)
- {
- return new Principal()
- {
- public String getName()
- {
- return name;
- }
- };
- }
-
- class TestResource implements Resource
- {
- private URI resourceURI;
-
- private Map<String, Object> contextMap;
-
- public TestResource(String resourceURI)
- {
- this.resourceURI = URI.create(resourceURI);
- this.contextMap = new HashMap<String, Object>();
- }
-
- public ResourceType getLayer()
- {
- return ResourceType.ACL;
- }
-
- public Map<String, Object> getMap()
- {
- return this.contextMap;
- }
-
- /**
- * <p>
- * Let's consider two {@code TestResources} to be equal if they have the same resource URI.
- * </p>
- */
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof TestResource)
- {
- TestResource other = (TestResource) obj;
- return other.resourceURI.equals(this.resourceURI);
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return this.resourceURI.hashCode();
- }
-
- @Override
- public String toString()
- {
- return this.resourceURI.toString();
- }
-
- public void add(String key, Object value)
- {
- this.contextMap.put(key, value);
- }
- }
-}
Modified: trunk/security-jboss-sx/acl/pom.xml
===================================================================
--- trunk/security-jboss-sx/acl/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/acl/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>jbosssx-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/security-jboss-sx/assembly/pom.xml
===================================================================
--- trunk/security-jboss-sx/assembly/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/assembly/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>jbosssx-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jbosssx</artifactId>
Modified: trunk/security-jboss-sx/identity/pom.xml
===================================================================
--- trunk/security-jboss-sx/identity/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/identity/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>jbosssx-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/security-jboss-sx/jbosssx/pom.xml
===================================================================
--- trunk/security-jboss-sx/jbosssx/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>jbosssx-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -111,13 +111,13 @@
</build>
<dependencies>
<dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-jaspi-api</artifactId>
+ <groupId>oswego-concurrent</groupId>
+ <artifactId>concurrent</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jaspi-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLBaseDefinition.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLBaseDefinition.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLBaseDefinition.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,128 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.acl.ACLEntry;
-
-/**
- * <p>
- * A container for holding the contents parsed from a {@code <acl-definition>} section of {@code jboss-acl.xml}.
- * </p>
- *
- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- * @since Jan 21, 2010
- */
-public class ACLBaseDefinition
-{
- protected static Logger logger = Logger.getLogger(ACLBaseDefinition.class);
-
- protected String resource;
-
- protected String baseResource;
-
- protected final Set<ACLEntry> entries = new HashSet<ACLEntry>();
-
- /**
- * <p>
- * Adds a parsed {@code ACLEntry} to the list of entries of this {@code ACLDefinition}.
- * </p>
- *
- * @param entry the {@code ACLEntry} to be added.
- */
- public void addACLEntry(Object entry)
- {
- logger.debug("addEntry: " + entry);
-
- if (entry instanceof ACLEntry)
- this.entries.add((ACLEntry) entry);
- }
-
- /**
- * <p>
- * Obtains the configured {@code <acl-definition>} resource.
- * </p>
- *
- * @return a {@code String} containing the resource as configured in the XML file.
- */
- public String getResource()
- {
- return resource;
- }
-
- /**
- * <p>
- * Obtains the configured {@code <acl-definition>} base-resource, as per the {@code extends} attribute in the XML
- * file.
- * </p>
- *
- * @return a {@code String} containing the base-resource as configured in the XML file, or {@code null} if no base
- * resource is available.
- */
- public String getBaseResource()
- {
- return baseResource;
- }
-
- /**
- * <p>
- * Obtains the ACL entries that have been configured in this ACL definition.
- * </p>
- *
- * @return a {@code List<ACLEntry>} containing the configured entries.
- */
- public Set<ACLEntry> getEntries()
- {
- return entries;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof ACLDefinition)
- {
- ACLBaseDefinition other = (ACLBaseDefinition) obj;
- return this.resource.equals(other.resource);
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode()
- {
- return this.resource.hashCode();
- }
-
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParser.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParser.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.io.InputStream;
-
-/**
- * Parses the ACL Configuration
- * @author Anil.Saldhana at redhat.com
- * @since Jan 20, 2010
- */
-public interface ACLConfigParser
-{
- /**
- * Given a stream of acl config, returns {@code ACLConfiguration}
- * @param aclConfigFileStream
- * @return
- */
- ACLConfiguration getConfiguration(InputStream aclConfigFileStream);
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserJBossXB.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserJBossXB.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserJBossXB.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.io.InputStream;
-
-import org.jboss.logging.Logger;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
-
-/**
- * A JBossXB based acl config parser
- * @author Anil.Saldhana at redhat.com
- * @since Jan 20, 2010
- */
-public class ACLConfigParserJBossXB implements ACLConfigParser
-{
- private static final String schemaName = "schema/jboss-acl-config_1_0.xsd";
-
- private static Logger log = Logger.getLogger(ACLConfigParserJBossXB.class);
-
- public ACLConfiguration getConfiguration(InputStream aclConfigFileStream)
- {
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- SchemaBinding schema = XsdBinder.bind(tcl.getResourceAsStream(schemaName), null);
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- try
- {
- ACLConfiguration configuration = (ACLConfiguration) unmarshaller.unmarshal(aclConfigFileStream, schema);
- return configuration;
- }
- catch (JBossXBException e)
- {
- log.debug("Error parsing ACL configuration file", e);
- throw new RuntimeException(e);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserStax.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserStax.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserStax.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.io.InputStream;
-
-/**
- * ACL Config Parser based on STAX
- * @author Anil.Saldhana at redhat.com
- * @since Jan 20, 2010
- */
-public class ACLConfigParserStax implements ACLConfigParser
-{
- /**
- * @see ACLConfigParser#getConfiguration(InputStream)
- */
- public ACLConfiguration getConfiguration(InputStream aclConfigFileStream)
- {
- return null;
- }
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfiguration.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfiguration.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfiguration.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,125 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.security.acl.ACL;
-import org.jboss.security.acl.ACLEntry;
-import org.jboss.security.acl.ACLImpl;
-
-/**
- * <p>
- * The {@code ACLConfiguration} class contains all ACL definitions that have been specified in an XML file according to
- * the {@code jboss-acl-configuration} schema. Each definition is used to construct an {@code ACL} instance that will
- * protect the specified resource according to the permissions that are assigned to each identity.
- * </p>
- *
- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- */
-public class ACLConfiguration
-{
-
- /** the set of ACL definitions keyed by their resource identifier. */
- private final Map<String, ACLBaseDefinition> definitions = new HashMap<String, ACLBaseDefinition>();
-
- /**
- * <p>
- * Adds a parsed {@code ACLDefinition} object to the map of definitions.
- * </p>
- *
- * @param definition the {@code ACLDefinition} instance to be added.
- */
- public void addDefinition(Object definition)
- {
- if (definition instanceof ACLBaseDefinition)
- {
- ACLBaseDefinition aclDefinition = (ACLBaseDefinition) definition;
- this.definitions.put(aclDefinition.getResource(), aclDefinition);
- }
- }
-
- /**
- * <p>
- * Creates and returns the {@code ACL} objects that correspond to the {@code acl-definition}s specified in the XML
- * configuration file.
- * </p>
- *
- * @return a {@code Set<ACL>} containing the generated {@code ACL}s.
- */
- public Set<ACL> getConfiguredACLs()
- {
- Set<ACL> configuredACLs = new HashSet<ACL>();
- for (ACLBaseDefinition definition : this.definitions.values())
- {
- Set<ACLEntry> entries = this.getEntries(definition, new ArrayList<String>());
- ACLImpl acl = new ACLImpl(definition.getResource(), entries);
- configuredACLs.add(acl);
- }
- return configuredACLs;
- }
-
- /**
- * <p>
- * This method retrieves the set of {@code ACLEntry} objects that belong to an ACL, recursively getting the entries
- * from the parent definitions when the extension configuration is used. An extending {@code ACLDefinition}
- * "inherits" the entries from its parent and is free to add or override entries as needed.
- * </p>
- *
- * @param definition the {@code ACLBaseDefinition} that contains the data used to retrieve the entries.
- * @param visitedACLs a {@code List} of the visited ACLs to detect circular dependencies.
- * @return a {@code Set<ACLEntry>} containing the entries that will be used to create an {@code ACL} according to the
- * specified definition.
- * @throws RuntimeException if a circular dependency is detected among the {@code ACLDefinition} objects.
- */
- private Set<ACLEntry> getEntries(ACLBaseDefinition definition, List<String> visitedACLs)
- {
- if (visitedACLs.contains(definition.getResource()))
- throw new RuntimeException("Circular dependency between ACLs has been detected");
-
- visitedACLs.add(definition.getResource());
- if (definition.getBaseResource() != null)
- {
- ACLBaseDefinition superDefinition = this.definitions.get(definition.getBaseResource());
- if (superDefinition != null)
- {
- Set<ACLEntry> superEntries = this.getEntries(superDefinition, visitedACLs);
- Set<ACLEntry> entries = definition.getEntries();
- entries.addAll(superEntries);
- return entries;
- }
- else
- {
- throw new RuntimeException("Parent ACL not found: " + definition.getBaseResource());
- }
- }
- else
- {
- return definition.getEntries();
- }
- }
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigurationFactory.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigurationFactory.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigurationFactory.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.io.InputStream;
-
-import org.jboss.logging.Logger;
-
-/**
- * <p>
- * Factory for {@code ACLConfiguration} objects.
- * </p>
- *
- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- */
-public class ACLConfigurationFactory
-{
- private static Logger log = Logger.getLogger(ACLConfigurationFactory.class);
-
- private static ACLConfigParser aclParser = null;
-
- static
- {
- //Let us try the JBossXB Parser if available
- String className = "org.jboss.security.acl.config.ACLConfigParserJBossXB";
- try
- {
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- Class<?> clazz = tcl.loadClass(className);
- aclParser = (ACLConfigParser) clazz.newInstance();
- }
- catch(Exception e)
- {
- if(log.isTraceEnabled())
- {
- log.trace("Exception initializing ACL Config Parser based on JBossXB", e);
- }
- //Fallback to general stax based parser
- aclParser = new ACLConfigParserStax();
- }
- }
-
- /**
- * <p>
- * Creates and return an {@code ACLConfiguration} object using the specified input stream to read the ACL
- * configuration file.
- * </p>
- *
- * @param aclConfigFileStream an {@code InputStream} that reads the contents of the ACL configuration file.
- * @return the constructed {@code ACLConfiguration} object that contains the configured ACLs.
- */
- public static ACLConfiguration getConfiguration(InputStream aclConfigFileStream)
- {
- if(aclParser == null)
- throw new IllegalStateException("ACL Config Parser is null");
- return aclParser.getConfiguration(aclConfigFileStream);
- }
-
- /**
- * Set a new {@code ACLConfigParser}
- * @param aclParserPassed
- */
- public static void setConfigParser(ACLConfigParser aclParserPassed)
- {
- aclParser = aclParserPassed;
- }
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLDefinition.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLDefinition.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLDefinition.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,107 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.xb.binding.GenericValueContainer;
-
-/**
- * <p>
- * A container for holding the contents parsed from a {@code <acl-definition>} section of {@code jboss-acl.xml}.
- * </p>
- *
- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- */
-public class ACLDefinition extends ACLBaseDefinition implements GenericValueContainer
-{
-
- private static Logger logger = Logger.getLogger(ACLDefinition.class);
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#addChild(javax.xml.namespace.QName, java.lang.Object)
- */
- public void addChild(QName name, Object value)
- {
- logger.debug("addChild: name=" + name + ", value=" + value);
-
- if ("resource".equals(name.getLocalPart()))
- {
- this.resource = (String) value;
- }
- else if ("extends".equals(name.getLocalPart()))
- {
- this.baseResource = (String) value;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#instantiate()
- */
- public Object instantiate()
- {
- return this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#getTargetClass()
- */
- public Class<?> getTargetClass()
- {
- return ACLDefinition.class;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof ACLDefinition)
- {
- ACLDefinition other = (ACLDefinition) obj;
- return this.resource.equals(other.resource);
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode()
- {
- return this.resource.hashCode();
- }
-
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLEntryHolder.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLEntryHolder.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLEntryHolder.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.acl.ACLEntry;
-import org.jboss.security.acl.ACLEntryImpl;
-import org.jboss.security.acl.BasicACLPermission;
-import org.jboss.security.acl.CompositeACLPermission;
-import org.jboss.security.identity.Identity;
-import org.jboss.security.identity.plugins.IdentityFactory;
-import org.jboss.xb.binding.GenericValueContainer;
-
-/**
- * <p>
- * A container for creating {@code ACLEntry} objects when a jboss-acl configuration is parsed by JBoss XB.
- * </p>
- *
- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- */
-public class ACLEntryHolder implements GenericValueContainer
-{
-
- private static Logger logger = Logger.getLogger(ACLEntryHolder.class);
-
- private Identity identity;
-
- private CompositeACLPermission permission;
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#addChild(javax.xml.namespace.QName, java.lang.Object)
- */
- public void addChild(QName name, Object value)
- {
- logger.debug("addChild: name=" + name + ", value=" + value);
-
- if ("identity-name".equals(name.getLocalPart()))
- {
- String identityName = (String) value;
- this.identity = this.getIdentityFromString(identityName);
- }
- else if ("permissions".equals(name.getLocalPart()))
- {
- String permissions = (String) value;
- this.permission = this.getPermissionsFromString(permissions);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#instantiate()
- */
- public Object instantiate()
- {
- return new ACLEntryImpl(this.permission, this.identity);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#getTargetClass()
- */
- public Class<?> getTargetClass()
- {
- return ACLEntry.class;
- }
-
- /**
- * <p>
- * Creates an {@code Identity} object from the specified {@code identityName} parameter.
- * </p>
- *
- * @param identityName a {@code String} that represents the identity to be built.
- * @return the constructed {@code Identity} instance, or {@code null} if the {@code Identity} object cannot be built.
- */
- private Identity getIdentityFromString(String identityName)
- {
- try
- {
- return IdentityFactory.createIdentity(identityName);
- }
- catch (Exception e)
- {
- logger.debug("Exception caught while constructing Identity object", e);
- return null;
- }
- }
-
- /**
- * <p>
- * Creates a {@code CompositeACLPermission} from the specified {@code permissionString} parameter.
- * </p>
- *
- * @param permissionString a {@code String} containing the permissions assigned to the identity, separated by a comma
- * (e.g. {@code CREATE,READ,UPDATE}).
- * @return the constructed {@code CompositeACLPermission} object.
- */
- private CompositeACLPermission getPermissionsFromString(String permissionString)
- {
- List<BasicACLPermission> permissions = new ArrayList<BasicACLPermission>();
- if (permissionString != null)
- {
- // extract each permission from the permission string.
- String[] elements = permissionString.split(",");
- for (String element : elements)
- {
- try
- {
- permissions.add(BasicACLPermission.valueOf(element));
- }
- catch (RuntimeException re)
- {
- logger.debug("No BasicACLPermission named " + element + " found", re);
- }
- }
- }
-
- return new CompositeACLPermission(permissions.toArray(new BasicACLPermission[permissions.size()]));
- }
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLInfoContainer.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLInfoContainer.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLInfoContainer.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.config.ACLInfo;
-import org.jboss.xb.binding.GenericValueContainer;
-
-/**
- * <p>
- * A container for creating {@code ACLInfo} objects when an application policy that specifies ACL modules is parsed by
- * JBoss XB.
- * </p>
- *
- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- */
-public class ACLInfoContainer implements GenericValueContainer
-{
- private static Logger log = Logger.getLogger(ACLInfoContainer.class);
-
- private final List<ACLProviderEntry> providerEntries = new ArrayList<ACLProviderEntry>();
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#addChild(javax.xml.namespace.QName, java.lang.Object)
- */
- public void addChild(QName name, Object value)
- {
- if (log.isTraceEnabled())
- log.trace("addChild:Qname=" + name + ":value=" + value);
-
- if (value instanceof ACLProviderEntry)
- {
- ACLProviderEntry entry = (ACLProviderEntry) value;
- this.providerEntries.add(entry);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#instantiate()
- */
- public Object instantiate()
- {
- ACLInfo info = new ACLInfo("dummy");
- info.add(providerEntries);
- return info;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#getTargetClass()
- */
- public Class<?> getTargetClass()
- {
- return ACLInfo.class;
- }
-
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLProviderEntryHolder.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLProviderEntryHolder.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLProviderEntryHolder.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,125 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.security.config.ControlFlag;
-import org.jboss.security.config.ModuleOption;
-import org.jboss.xb.binding.GenericValueContainer;
-
-/**
- * <p>
- * A container for creating {@code ACLProviderEntry} objects when an application policy that specifies ACL modules is
- * parsed by JBoss XB.
- * </p>
- *
- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- */
-public class ACLProviderEntryHolder implements GenericValueContainer
-{
- private String moduleName = null;
-
- private ControlFlag controlFlag = ControlFlag.REQUIRED;
-
- private final Map<String, Object> moduleOptions = new HashMap<String, Object>();
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#addChild(javax.xml.namespace.QName, java.lang.Object)
- */
- public void addChild(QName name, Object value)
- {
- // the fully-qualified class name of the ACLProvider.
- if ("code".equals(name.getLocalPart()))
- {
- this.moduleName = (String) value;
- }
- // the control flag.
- if ("flag".equals(name.getLocalPart()))
- {
- String flag = (String) value;
- if ("optional".equals(flag))
- this.controlFlag = ControlFlag.OPTIONAL;
- else if ("requisite".equals(flag))
- this.controlFlag = ControlFlag.REQUISITE;
- else if ("sufficient".equals(flag))
- this.controlFlag = ControlFlag.SUFFICIENT;
- }
- // the options of the ACLProvider.
- if (value instanceof ModuleOption)
- {
- ModuleOption option = (ModuleOption) value;
- this.moduleOptions.put(option.getName(), option.getValue());
- }
- }
-
- /**
- * <p>
- * Adds the specified option to the set of options used by the {@code ACLProvider}.
- * </p>
- *
- * @param option a {@code ModuleOption} instance representing the option to be added.
- */
- public void addOption(ModuleOption option)
- {
- moduleOptions.put(option.getName(), option.getValue());
- }
-
- /**
- * <p>
- * Constructs and returns an {@code ACLProviderEntry} with the information contained in this class.
- * </p>
- *
- * @return a reference to the constructed {@code ACLProviderEntry} object.
- */
- public ACLProviderEntry getEntry()
- {
- return (ACLProviderEntry) instantiate();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#instantiate()
- */
- public Object instantiate()
- {
- ACLProviderEntry entry = new ACLProviderEntry(this.moduleName, this.moduleOptions);
- entry.setControlFlag(this.controlFlag);
- return entry;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#getTargetClass()
- */
- public Class<?> getTargetClass()
- {
- return ACLProviderEntry.class;
- }
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/SecurityActions.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/SecurityActions.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/SecurityActions.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.acl.config;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Privileged Blocks
- * @author Anil.Saldhana at redhat.com
- * @since Mar 18, 2009
- */
-class SecurityActions
-{
- static ClassLoader getContextClassLoader()
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/audit/config/AuditConfigEntryHolder.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/audit/config/AuditConfigEntryHolder.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/audit/config/AuditConfigEntryHolder.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,78 +0,0 @@
-/*
- * 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.audit.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.security.config.ModuleOption;
-import org.jboss.xb.binding.GenericValueContainer;
-
-//$Id$
-
-/**
- * A container for creating AuditConfigEntry during jbxb parse
- * @author Anil.Saldhana at redhat.com
- * @since Aug 14, 2007
- * @version $Revision$
- */
-public class AuditConfigEntryHolder implements GenericValueContainer
-{
- private Map<String,Object> moduleOptions = new HashMap<String,Object>();
- String moduleName = null;
-
- public void addChild(QName name, Object value)
- {
- if("code".equals(name.getLocalPart()))
- {
- moduleName = (String)value;
- }
- if(value instanceof ModuleOption)
- {
- ModuleOption mo = (ModuleOption)value;
- moduleOptions.put(mo.getName(),mo.getValue());
- }
- }
-
- public void addOption(ModuleOption option)
- {
- moduleOptions.put(option.getName(), option.getValue());
- }
-
- public AuditProviderEntry getEntry()
- {
- return (AuditProviderEntry)instantiate();
- }
-
- public Object instantiate()
- {
- AuditProviderEntry entry = new AuditProviderEntry( moduleName,moduleOptions );
- return entry;
- }
-
- public Class<?> getTargetClass()
- {
- return AuditProviderEntry.class;
- }
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/config/AuthModuleEntryHolder.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/config/AuthModuleEntryHolder.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/container/config/AuthModuleEntryHolder.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.auth.container.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.security.config.ModuleOption;
-import org.jboss.xb.binding.GenericValueContainer;
-
-//$Id$
-
-/**
- * JBXB Container for parsing an AuthModuleEntry (A configuration entry for
- * JSR-196 Auth Modules that is similar to the JAAS AppConfigurationEntry)
- * @author <a href="mailto:anil.saldhana at jboss.org>anil.saldhana at jboss.org</a>
- * @since Dec 20, 2005
- */
-public class AuthModuleEntryHolder implements GenericValueContainer
-{
- private Map<String,Object> moduleOptions = new HashMap<String,Object>();
- String moduleName = null;
- String loginModuleStackRefName = null;
-
- public void addChild(QName name, Object value)
- {
- if("code".equals(name.getLocalPart()))
- {
- moduleName = (String)value;
- }
- else if( "login-module-stack-ref".equals(name.getLocalPart()))
- {
- loginModuleStackRefName = (String)value;
- }
- if(value instanceof ModuleOption)
- {
- ModuleOption mo = (ModuleOption)value;
- moduleOptions.put(mo.getName(),mo.getValue());
- }
- }
-
- public void addOption(ModuleOption option)
- {
- moduleOptions.put(option.getName(), option.getValue());
- }
-
- public AuthModuleEntry getEntry()
- {
- return new AuthModuleEntry( moduleName,moduleOptions,loginModuleStackRefName );
- }
-
- public Object instantiate()
- {
- return new AuthModuleEntry( moduleName,moduleOptions,loginModuleStackRefName );
- }
-
- public Class<?> getTargetClass()
- {
- return AuthModuleEntry.class;
- }
-
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/AppConfigurationEntryHolder.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/AppConfigurationEntryHolder.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/AppConfigurationEntryHolder.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,117 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, 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.auth.login;
-
-import java.util.HashMap;
-
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
-import javax.xml.namespace.QName;
-
-import org.jboss.security.config.ModuleOption;
-import org.jboss.xb.binding.GenericValueContainer;
-
-/**
- * A container for creating AppConfigurationEntry during jbxb parse.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class AppConfigurationEntryHolder
- implements GenericValueContainer
-{
- String code;
- LoginModuleControlFlag controlFlag = LoginModuleControlFlag.REQUIRED;
- HashMap<String,Object> options = new HashMap<String,Object>();
-
- // GenericValueContainer should have default ctor
- public AppConfigurationEntryHolder()
- {
- }
-
- AppConfigurationEntryHolder(String code, String flag)
- {
- this.code = code;
- controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
- if (flag != null)
- {
- // Lower case is what is used by the jdk1.4.1 implementation
- flag = flag.toLowerCase();
- if (AppConfigurationEntry.LoginModuleControlFlag.REQUIRED.toString().indexOf(flag) > 0)
- controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
- else if (AppConfigurationEntry.LoginModuleControlFlag.REQUISITE.toString().indexOf(flag) > 0)
- controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUISITE;
- else if (AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT.toString().indexOf(flag) > 0)
- controlFlag = AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT;
- else if (AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL.toString().indexOf(flag) > 0)
- controlFlag = AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;
- }
- }
-
- public AppConfigurationEntry getEntry()
- {
- AppConfigurationEntry entry = new AppConfigurationEntry(code, controlFlag, options);
- return entry;
- }
-
- public void addOption(ModuleOption option)
- {
- options.put(option.getName(), option.getValue());
- }
-
- // GenericValueContainer impl
-
- public void addChild(QName name, Object value)
- {
- if("code".equals(name.getLocalPart()))
- {
- this.code = (String)value;
- }
- else if("flag".equals(name.getLocalPart()))
- {
- // Lower case is what is used by the jdk1.4.1 implementation
- String flag = ((String)value).toLowerCase();
- if (AppConfigurationEntry.LoginModuleControlFlag.REQUIRED.toString().indexOf(flag) > 0)
- controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
- else if (AppConfigurationEntry.LoginModuleControlFlag.REQUISITE.toString().indexOf(flag) > 0)
- controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUISITE;
- else if (AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT.toString().indexOf(flag) > 0)
- controlFlag = AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT;
- else if (AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL.toString().indexOf(flag) > 0)
- controlFlag = AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;
- }
- else if("module-option".equals(name.getLocalPart()))
- {
- addOption((ModuleOption)value);
- }
- }
-
- public Object instantiate()
- {
- return new AppConfigurationEntry(code, controlFlag, options);
- }
-
- public Class<?> getTargetClass()
- {
- return AppConfigurationEntry.class;
- }
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/AuthenticationInfoContainer.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/AuthenticationInfoContainer.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/AuthenticationInfoContainer.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,116 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, 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.auth.login;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.auth.container.config.AuthModuleEntry;
-import org.jboss.xb.binding.GenericValueContainer;
-
-/**
- * A container for creating AuthenticationInfo during jbxb parse.
- *
- * @author Scott.Stark at jboss.org
- * @author <a href="mailto:anil.saldhana at jboss.org>anil.saldhana at jboss.org</a>
- * @version $Revision$
- */
-public class AuthenticationInfoContainer
- implements GenericValueContainer
-{
- private static Logger log = Logger.getLogger(AuthenticationInfoContainer.class);
-
- BaseAuthenticationInfo info = null;
-
- String authName = null;
-
- @SuppressWarnings("unchecked")
- List moduleEntries = new ArrayList();
-
- @SuppressWarnings("unchecked")
- Map loginModuleStackMap = new HashMap();
-
- boolean isJASPIAuthentication = false;
-
- @SuppressWarnings("unchecked")
- public void addChild(QName name, Object value)
- {
- log.debug("addChild::" + name + ":" + value);
- if("name".equals(name.getLocalPart()))
- {
- authName = (String)value;
- }
- else if( value instanceof AppConfigurationEntryHolder )
- {
- AppConfigurationEntryHolder ace = (AppConfigurationEntryHolder) value;
- moduleEntries.add(ace.getEntry());
- }
- else if( value instanceof AppConfigurationEntry )
- {
- AppConfigurationEntry ace = (AppConfigurationEntry) value;
- moduleEntries.add(ace);
- }
- else if( value instanceof AuthModuleEntry )
- {
- AuthModuleEntry ame = (AuthModuleEntry)value;
- //Check if the authmodule needs a reference to a loginmodulestack
- String lmshName = ame.getLoginModuleStackHolderName();
- if( lmshName != null )
- ame.setLoginModuleStackHolder((LoginModuleStackHolder)loginModuleStackMap.get(lmshName));
- moduleEntries.add(ame);
- this.isJASPIAuthentication = true;
- }
- else if( value instanceof LoginModuleStackHolder )
- {
- LoginModuleStackHolder lmsh = (LoginModuleStackHolder)value;
- loginModuleStackMap.put( lmsh.getName(), lmsh );
- }
- }
-
- @SuppressWarnings("unchecked")
- public Object instantiate()
- {
- if(isJASPIAuthentication == false)
- {
- info = new AuthenticationInfo(authName);
- }
- else
- {
- info = new JASPIAuthenticationInfo(authName);
- }
-
- info.add(moduleEntries);
- return info;
- }
-
- public Class<?> getTargetClass()
- {
- return BaseAuthenticationInfo.class;
- }
-
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/JBossXBParsingUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/JBossXBParsingUtil.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/JBossXBParsingUtil.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.auth.login;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Set;
-
-import org.jboss.security.auth.spi.UsersObjectModelFactory;
-import org.jboss.security.authorization.config.SecurityConfigObjectModelFactory;
-import org.jboss.security.config.ApplicationPolicy;
-import org.jboss.security.config.PolicyConfig;
-import org.jboss.security.config.SecurityConfiguration;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-/**
- * Parsing utility using JBossXB
- * @author Anil.Saldhana at redhat.com
- * @since May 30, 2008
- */
-public class JBossXBParsingUtil
-{
- private XMLLoginConfigImpl xmlConfig = XMLLoginConfigImpl.getInstance();
-
- public void parse(URL loginConfigURL, ArrayList<String> configNames) throws Exception
- {
- LoginConfigObjectModelFactory lcomf = new SecurityConfigObjectModelFactory();
- UsersObjectModelFactory uomf = new UsersObjectModelFactory();
-
- InputStreamReader xmlReader = loadURL(loginConfigURL);
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.mapFactoryToNamespace(uomf, "http://www.jboss.org/j2ee/schemas/XMLLoginModule");
- Object root = null;
- PolicyConfig config = (PolicyConfig) unmarshaller.unmarshal(xmlReader, lcomf, root);
- Set<String> cnames = config.getConfigNames();
- configNames.addAll(cnames);
- xmlConfig.copy(config);
-
- // Add the config to SecurityConfiguration
- for (String cname : cnames)
- {
- ApplicationPolicy ap = config.get(cname);
- SecurityConfiguration.addApplicationPolicy(ap);
- handleJASPIDelegation(ap);
- }
-
- }
-
- private void handleJASPIDelegation(ApplicationPolicy aPolicy)
- {
- BaseAuthenticationInfo bai = aPolicy.getAuthenticationInfo();
- if (bai instanceof JASPIAuthenticationInfo)
- {
- JASPIAuthenticationInfo jai = (JASPIAuthenticationInfo) bai;
- LoginModuleStackHolder[] lmsharr = jai.getLoginModuleStackHolder();
- for (LoginModuleStackHolder lmsh : lmsharr)
- {
- xmlConfig.addAppConfig(lmsh.getName(), lmsh.getAppConfigurationEntry());
- }
- }
- }
-
- private InputStreamReader loadURL(URL configURL) throws IOException
- {
- InputStream is = configURL.openStream();
- if (is == null)
- throw new IOException("Failed to obtain InputStream from url: " + configURL);
- InputStreamReader xmlReader = new InputStreamReader(is);
- return xmlReader;
- }
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginConfigObjectModelFactory.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginConfigObjectModelFactory.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginConfigObjectModelFactory.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,361 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.auth.login;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.security.auth.login.AppConfigurationEntry;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.auth.container.config.AuthModuleEntry;
-import org.jboss.security.config.ApplicationPolicy;
-import org.jboss.security.config.ControlFlag;
-import org.jboss.security.config.ModuleOption;
-import org.jboss.security.config.PolicyConfig;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * A JBossXB object factory for parsing the login-config.xml object model.
- *
- * @author Scott.Stark at jboss.org
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil.Saldhana at jboss.org</a>
- * @version $Revision$
- */
-public class LoginConfigObjectModelFactory implements ObjectModelFactory
-{
- private static Logger log = Logger.getLogger(LoginConfigObjectModelFactory.class);
-
- private boolean trace;
-
- protected final Map<String, ControlFlag> controlFlags;
-
- public LoginConfigObjectModelFactory()
- {
- this.controlFlags = new HashMap<String, ControlFlag>();
- controlFlags.put("REQUIRED", ControlFlag.REQUIRED);
- controlFlags.put("REQUISITE", ControlFlag.REQUISITE);
- controlFlags.put("OPTIONAL", ControlFlag.OPTIONAL);
- controlFlags.put("SUFFICIENT", ControlFlag.SUFFICIENT);
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name)
- {
- if (trace)
- log.trace("completeRoot");
- return root;
- }
-
- public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName,
- Attributes attrs)
- {
- trace = log.isTraceEnabled();
- if (!localName.equals("policy"))
- {
- throw new IllegalStateException("Unexpected root element: was expecting 'policy' but got '" + localName + "'");
- }
- if (trace)
- log.trace("newRoot, created PolicyConfig for policy element");
- return new PolicyConfig();
- }
-
- public Object newChild(PolicyConfig config, UnmarshallingContext navigator, String namespaceUri, String localName,
- Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.PolicyConfig, localName: " + localName);
- if ("application-policy".equals(localName))
- {
- String name = attrs.getValue("name");
- name = StringPropertyReplacer.replaceProperties(name);
- ApplicationPolicy aPolicy = new ApplicationPolicy(name);
- aPolicy.setPolicyConfig(config);
- String baseAppPolicyName = attrs.getValue("extends");
- if (baseAppPolicyName != null)
- aPolicy.setBaseApplicationPolicyName(baseAppPolicyName);
- if (trace)
- log.trace("newChild.PolicyConfig, AuthenticationInfo: " + name);
- child = aPolicy;
- }
- return child;
- }
-
- public Object newChild(ApplicationPolicy aPolicy, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.ApplicationPolicy, localName: " + localName);
- String name = aPolicy.getName();
- if ("authentication".equals(localName))
- {
- child = new AuthenticationInfo(name);
- if (trace)
- log.trace("newChild.PolicyConfig, AuthenticationInfo: " + name);
- }
- else if ("authentication-jaspi".equals(localName))
- {
- child = new JASPIAuthenticationInfo(name);
- if (trace)
- log.trace("newChild.PolicyConfig, AuthenticationInfo: " + name);
- }
- return child;
- }
-
- public Object newChild(BaseAuthenticationInfo info, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.AuthenticationInfo, localName: " + localName);
- if ("authentication".equals(localName))
- {
- child = new AuthenticationInfo(info.getName());
- if (trace)
- log.trace("newChild.PolicyConfig, AuthenticationInfo: " + info.getName());
- }
- else if ("authentication-jaspi".equals(localName))
- {
- child = new JASPIAuthenticationInfo(info.getName());
- if (trace)
- log.trace("newChild.PolicyConfig, AuthenticationInfo: " + info.getName());
- }
- return child;
- }
-
- public Object newChild(AuthenticationInfo info, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.AuthenticationInfo, localName: " + localName);
- if ("login-module".equals(localName))
- {
- String code = attrs.getValue("code");
- code = StringPropertyReplacer.replaceProperties(code.trim());
- String flag = attrs.getValue("flag");
- if (flag != null)
- flag = StringPropertyReplacer.replaceProperties(flag.trim());
- AppConfigurationEntryHolder holder = new AppConfigurationEntryHolder(code, flag);
- child = holder;
- if (trace)
- log.trace("newChild.AuthenticationInfo, login-module code: " + code);
- }
-
- return child;
- }
-
- public Object newChild(JASPIAuthenticationInfo info, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.AuthenticationJaspiInfo, localName: " + localName);
- if ("login-module-stack".equals(localName))
- {
- String lmsName = attrs.getValue("name");
- lmsName = StringPropertyReplacer.replaceProperties(lmsName.trim());
- child = new LoginModuleStackHolder(lmsName, null);
- if (trace)
- log.trace("newChild.AuthenticationInfo, login-module-stack: " + lmsName);
- }
- else if ("auth-module".equals(localName))
- {
- String code = attrs.getValue("code");
- AuthModuleEntry authModuleEntry = new AuthModuleEntry(code, null, null);
-
- String flag = attrs.getValue("flag");
- authModuleEntry.setControlFlag(getControlFlag(flag));
-
- String lmsRef = attrs.getValue("login-module-stack-ref");
- if (lmsRef != null)
- authModuleEntry.setLoginModuleStackHolder(info.getLoginModuleStackHolder(lmsRef));
- child = authModuleEntry;
- }
-
- return child;
- }
-
- public Object newChild(LoginModuleStackHolder entry, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.LoginModuleStackHolder, localName: " + localName);
- if ("login-module".equals(localName))
- {
- String code = attrs.getValue("code");
- code = StringPropertyReplacer.replaceProperties(code.trim());
- String flag = attrs.getValue("flag");
- flag = StringPropertyReplacer.replaceProperties(flag.trim());
- AppConfigurationEntryHolder holder = new AppConfigurationEntryHolder(code, flag);
- child = holder;
- if (trace)
- log.trace("newChild.AuthenticationInfo, login-module code: " + code);
- }
-
- return child;
- }
-
- public Object newChild(AppConfigurationEntryHolder entry, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.AppConfigurationEntryHolder, localName: " + localName);
- if ("module-option".equals(localName))
- {
- String name = attrs.getValue("name");
- child = new ModuleOption(name);
- if (trace)
- log.trace("newChild.AppConfigurationEntryHolder, module-option name: " + name);
- }
-
- return child;
- }
-
- public Object newChild(AuthModuleEntry entry, UnmarshallingContext navigator, String namespaceUri, String localName,
- Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.AppConfigurationEntryHolder, localName: " + localName);
- if ("module-option".equals(localName))
- {
- String name = attrs.getValue("name");
- child = new ModuleOption(name);
- if (trace)
- log.trace("newChild.AuthModuleEntry, module-option name: " + name);
- }
-
- return child;
- }
-
- public void setValue(ModuleOption option, UnmarshallingContext navigator, String namespaceUri, String localName,
- String value)
- {
- if ("module-option".equals(localName))
- {
- String valueWithReplacement = StringPropertyReplacer.replaceProperties(value.trim());
- option.setValue(valueWithReplacement);
- if (trace)
- log.trace("setValue.ModuleOption, name: " + localName + ":valueWithReplacement:" + valueWithReplacement);
- }
- }
-
- public void addChild(ModuleOption option, Object value, UnmarshallingContext navigator, String namespaceURI,
- String localName)
- {
- option.setValue(value);
- if (trace)
- log.trace("addChild.ModuleOption, name: " + option.getName());
- }
-
- public void addChild(AuthenticationInfo authInfo, AppConfigurationEntryHolder entryInfo,
- UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- AppConfigurationEntry entry = entryInfo.getEntry();
- authInfo.addAppConfigurationEntry(entry);
- if (trace)
- log.trace("addChild.AuthenticationInfo, name: " + entry.getLoginModuleName());
- }
-
- public void addChild(AppConfigurationEntryHolder entryInfo, ModuleOption option, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- entryInfo.addOption(option);
- if (trace)
- log.trace("addChild.AppConfigurationEntryHolder, name: " + option.getName());
- }
-
- public void addChild(JASPIAuthenticationInfo authInfo, AuthModuleEntry entry, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- authInfo.add(entry);
- }
-
- public void addChild(LoginModuleStackHolder lmsh, AppConfigurationEntryHolder entryInfo,
- UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- lmsh.addAppConfigurationEntry(entryInfo.getEntry());
- if (trace)
- log.trace("addChild.LoginModuleStackHolder, name: " + entryInfo.getEntry().getLoginModuleName());
- }
-
- public void addChild(AuthModuleEntry entry, ModuleOption option, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- entry.addOption(option);
- if (trace)
- log.trace("addChild.AppConfigurationEntryHolder, name: " + option.getName());
- }
-
- public void addChild(JASPIAuthenticationInfo authInfo, LoginModuleStackHolder lmsHolder,
- UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- authInfo.add(lmsHolder);
- }
-
- public void addChild(ApplicationPolicy aPolicy, JASPIAuthenticationInfo authInfo, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- aPolicy.setAuthenticationInfo(authInfo);
- if (trace)
- log.trace("addChild.ApplicationPolicy, name: " + aPolicy.getName());
- }
-
- public void addChild(ApplicationPolicy aPolicy, AuthenticationInfo authInfo, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- aPolicy.setAuthenticationInfo(authInfo);
- if (trace)
- log.trace("addChild.ApplicationPolicy, name: " + aPolicy.getName());
- }
-
- public void addChild(PolicyConfig pc, ApplicationPolicy aPolicy, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- pc.add(aPolicy);
- if (trace)
- log.trace("Added ApplicationPolicy to PolicyConfig, name: " + aPolicy.getName());
- }
-
- public ControlFlag getControlFlag(String flag)
- {
- ControlFlag controlFlag = null;
-
- if(flag != null)
- {
- flag = StringPropertyReplacer.replaceProperties(flag.trim());
- controlFlag = this.controlFlags.get(flag.toUpperCase());
- }
- if (controlFlag == null)
- controlFlag = ControlFlag.REQUIRED;
-
- return controlFlag;
- }
-
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginModuleStackContainer.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginModuleStackContainer.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/LoginModuleStackContainer.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.auth.login;
-
-import java.util.ArrayList;
-
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.xml.namespace.QName;
-
-import org.jboss.xb.binding.GenericValueContainer;
-
-//$Id$
-
-/**
- * A container for creating LoginModuleStack during jbxb parse.
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Dec 24, 2005
- * @version $Revision$
- */
- at SuppressWarnings("unchecked")
-public class LoginModuleStackContainer implements GenericValueContainer
-{
- String lmsName = null;
-
- private ArrayList appEntries = new ArrayList();
-
- public void addChild(QName name, Object value)
- {
- if("name".equals(name.getLocalPart()))
- {
- lmsName = (String)value;
- }
- if( value instanceof AppConfigurationEntry)
- appEntries.add(value);
- }
-
- public Object instantiate()
- {
- return new LoginModuleStackHolder(lmsName, appEntries);
- }
-
- public Class getTargetClass()
- {
- return LoginModuleStackHolder.class;
- }
-
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/ModuleOptionContainer.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/ModuleOptionContainer.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/ModuleOptionContainer.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,92 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, 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.auth.login;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.security.config.ModuleOption;
-import org.jboss.xb.binding.GenericValueContainer;
-
-/**
- * ModuleOption declares a constructor that takes name as a parameter while the
- * value should be set with the setter. This use-case is not supported
- * out-of-the-box by jbxb, so, we use this container.
- *
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision$</tt>
- */
-public class ModuleOptionContainer
- implements GenericValueContainer
-{
- private String name;
- private Object value;
-
-
- /**
- @return - the option value
- */
- public Object getValue()
- {
- return value;
- }
-
- /**
- Setter used when the module option is passed as the text body of the
- module-option element.
-
- @param value - text value
- */
- public void setValue(Object value)
- {
- this.value = value;
- }
-
- /**
- Add attributes or nested element content.
-
- @param name - the attribute or element name
- @param value - the attribute or element value
- */
- public void addChild(QName name, Object value)
- {
- if("name".equals(name.getLocalPart()))
- {
- this.name = (String)value;
- }
- else
- {
- this.value = value;
- }
- }
-
- public Object instantiate()
- {
- ModuleOption option = new ModuleOption(name);
- option.setValue(value);
- return option;
- }
-
- public Class<?> getTargetClass()
- {
- return ModuleOption.class;
- }
-}
Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/XMLLoginConfigImpl.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/XMLLoginConfigImpl.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/login/XMLLoginConfigImpl.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -41,6 +41,7 @@
import org.jboss.security.config.ApplicationPolicyRegistration;
import org.jboss.security.config.PolicyConfig;
import org.jboss.security.config.SecurityConfiguration;
+import org.jboss.security.config.parser.StaxBasedConfigParser;
/**
* An concrete implementation of the javax.security.auth.login.Configuration class that parses an xml configuration of
@@ -444,7 +445,7 @@
@SuppressWarnings("unchecked")
private void loadXMLConfig(URL loginConfigURL, ArrayList configNames) throws Exception
{
- JBossXBParsingUtil xbUtil = new JBossXBParsingUtil();
- xbUtil.parse(loginConfigURL, configNames);
+ StaxBasedConfigParser parser = new StaxBasedConfigParser();
+ parser.parse(loginConfigURL.openStream());
}
}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersObjectModelFactory.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersObjectModelFactory.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersObjectModelFactory.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,103 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, 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.auth.spi;
-
-import org.jboss.logging.Logger;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/** A JBossXB object factory for parsing the
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class UsersObjectModelFactory implements ObjectModelFactory
-{
- private static Logger log = Logger.getLogger(UsersObjectModelFactory.class);
- private boolean trace = log.isTraceEnabled();
-
- public Object newRoot(Object root, UnmarshallingContext navigator,
- String namespaceURI, String localName, Attributes attrs)
- {
- if (!localName.equals("users"))
- {
- throw new IllegalStateException("Unexpected root element: was expecting 'users' but got '" + localName + "'");
- }
- if(trace)
- log.trace("newRoot, root="+root);
- return new Users();
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name)
- {
- return root;
- }
-
- public void setValue(Users users, UnmarshallingContext navigator,
- String namespaceUri, String localName, String value)
- {
- }
-
- public Object newChild(Users users, UnmarshallingContext navigator,
- String namespaceUri, String localName, Attributes attrs)
- {
- Users.User child = null;
- if("user".equals(localName))
- {
- String name = attrs.getValue("name");
- child = new Users.User(name);
- String password = attrs.getValue("password");
- child.setPassword(password);
- String encoding = attrs.getValue("encoding");
- child.setEncoding(encoding);
- if(trace)
- log.trace("newChild, user="+child);
- }
- return child;
- }
-
- public void addChild(Users users, Users.User user,
- UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- users.addUser(user);
- }
-
- public Object newChild(Users.User user, UnmarshallingContext navigator,
- String namespaceUri, String localName, Attributes attrs)
- {
- String[] roleInfo = {null, "Roles"};
- if("role".equals(localName))
- {
- roleInfo[0] = attrs.getValue("name");
- roleInfo[1] = attrs.getValue("group");
- if( roleInfo[1] == null )
- roleInfo[1] = "Roles";
- }
- return roleInfo;
- }
-
- public void addChild(Users.User user, String[] roleInfo,
- UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- user.addRole(roleInfo[0], roleInfo[1]);
- }
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/AuthorizationInfoContainer.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/AuthorizationInfoContainer.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/AuthorizationInfoContainer.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,79 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, 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.authorization;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.authorization.config.AuthorizationConfigEntryHolder;
-import org.jboss.security.authorization.config.AuthorizationModuleEntry;
-import org.jboss.security.config.AuthorizationInfo;
-import org.jboss.xb.binding.GenericValueContainer;
-
-//$Id$
-
-/**
- * A container for creating AuthorizationInfo during jbxb parse.
- *
- * @author anil.saldhana at jboss.org
- * @version $Revision$
- */
-public class AuthorizationInfoContainer
- implements GenericValueContainer
-{
- private static Logger log = Logger.getLogger(AuthorizationInfoContainer.class);
-
- AuthorizationInfo info = null;
-
- String authName = null;
-
- List<AuthorizationModuleEntry> moduleEntries = new ArrayList<AuthorizationModuleEntry>();
-
- public void addChild(QName name, Object value)
- {
- log.debug("addChild::" + name + ":" + value);
- if("name".equals(name.getLocalPart()))
- {
- authName = (String)value;
- }
- else if( value instanceof AuthorizationConfigEntryHolder )
- {
- AuthorizationConfigEntryHolder ace = (AuthorizationConfigEntryHolder) value;
- moduleEntries.add(ace.getEntry());
- }
- }
-
- public Object instantiate()
- {
- info = new AuthorizationInfo(authName);
- info.add(moduleEntries);
- return info;
- }
-
- public Class<?> getTargetClass()
- {
- return AuthorizationInfo.class;
- }
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/config/AuthorizationConfigEntryHolder.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/config/AuthorizationConfigEntryHolder.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/config/AuthorizationConfigEntryHolder.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.authorization.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.security.config.ControlFlag;
-import org.jboss.security.config.ModuleOption;
-import org.jboss.xb.binding.GenericValueContainer;
-
-//$Id$
-
-/**
- * A container for creating AuthorizationConfigurationEntry during jbxb parse.
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Jun 9, 2006
- * @version $Revision$
- */
-public class AuthorizationConfigEntryHolder implements GenericValueContainer
-{
- private Map<String,Object> moduleOptions = new HashMap<String,Object>();
- String moduleName = null;
- ControlFlag controlFlag = ControlFlag.REQUIRED;
-
- public void addChild(QName name, Object value)
- {
- if("code".equals(name.getLocalPart()))
- {
- moduleName = (String)value;
- }
- if("flag".equals(name.getLocalPart()))
- {
- String tempVal = (String)value;
- if("optional".equals(tempVal))
- controlFlag = ControlFlag.OPTIONAL;
- else
- if("requisite".equals(tempVal))
- controlFlag = ControlFlag.REQUISITE;
- else
- if("sufficient".equals(tempVal))
- controlFlag = ControlFlag.SUFFICIENT;
- }
- if(value instanceof ModuleOption)
- {
- ModuleOption mo = (ModuleOption)value;
- moduleOptions.put(mo.getName(),mo.getValue());
- }
- }
-
- public void addOption(ModuleOption option)
- {
- moduleOptions.put(option.getName(), option.getValue());
- }
-
- public AuthorizationModuleEntry getEntry()
- {
- return (AuthorizationModuleEntry)instantiate();
- }
-
- public Object instantiate()
- {
- AuthorizationModuleEntry entry = new AuthorizationModuleEntry( moduleName,moduleOptions );
- entry.setControlFlag(controlFlag);
- return entry;
- }
-
- public Class<?> getTargetClass()
- {
- return AuthorizationModuleEntry.class;
- }
-
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/config/SecurityConfigObjectModelFactory.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/config/SecurityConfigObjectModelFactory.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/authorization/config/SecurityConfigObjectModelFactory.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,479 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.authorization.config;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.acl.config.ACLProviderEntry;
-import org.jboss.security.audit.config.AuditProviderEntry;
-import org.jboss.security.auth.login.LoginConfigObjectModelFactory;
-import org.jboss.security.config.ACLInfo;
-import org.jboss.security.config.ApplicationPolicy;
-import org.jboss.security.config.AuditInfo;
-import org.jboss.security.config.AuthorizationInfo;
-import org.jboss.security.config.ControlFlag;
-import org.jboss.security.config.IdentityTrustInfo;
-import org.jboss.security.config.MappingInfo;
-import org.jboss.security.config.ModuleOption;
-import org.jboss.security.identitytrust.config.IdentityTrustModuleEntry;
-import org.jboss.security.mapping.config.MappingModuleEntry;
-import org.jboss.util.StringPropertyReplacer;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-// $Id$
-
-/**
- * JBossXB Object Factory capable of parsing the security configuration file that can include both
- * authentication,authorization and mapping module configuration
- *
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Jun 9, 2006
- * @version $Revision$
- */
-public class SecurityConfigObjectModelFactory extends LoginConfigObjectModelFactory
-{
- private static Logger log = Logger.getLogger(SecurityConfigObjectModelFactory.class);
-
- private final boolean trace = log.isTraceEnabled();
-
- /**
- * <p>
- * Creates an instance of {@code SecurityConfigObjectModelFactory}.
- * </p>
- */
- public SecurityConfigObjectModelFactory()
- {
- }
-
- @Override
- public Object newChild(ApplicationPolicy aPolicy, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = super.newChild(aPolicy, navigator, namespaceUri, localName, attrs);
- if (child == null && "authorization".equals(localName))
- {
- child = new AuthorizationInfo(aPolicy.getName());
- }
- else if (child == null && "acl".equals(localName))
- {
- child = new ACLInfo(aPolicy.getName());
- }
- else if (child == null && "mapping".equals(localName))
- {
- child = new MappingInfo(aPolicy.getName());
- }
- else if (child == null && "rolemapping".equals(localName))
- {
- child = new MappingInfo(aPolicy.getName());
- }
- else if (child == null && "audit".equals(localName))
- {
- child = new AuditInfo(aPolicy.getName());
- }
- else if (child == null && "identity-trust".equals(localName))
- {
- child = new IdentityTrustInfo(aPolicy.getName());
- }
- return child;
- }
-
- // authorization
- public Object newChild(AuthorizationInfo info, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.AuthorizationInfo, localName: " + localName);
- if ("policy-module".equals(localName))
- {
- String code = attrs.getValue("code");
- code = StringPropertyReplacer.replaceProperties(code.trim());
-
- String flag = attrs.getValue("flag");
- if (flag == null)
- flag = "REQUIRED";
- flag = StringPropertyReplacer.replaceProperties(flag.trim());
-
- ControlFlag controlFlag = this.controlFlags.get(flag.toUpperCase());
- if (controlFlag == null)
- controlFlag = ControlFlag.REQUIRED;
-
- AuthorizationModuleEntry entry = new AuthorizationModuleEntry(code);
- entry.setControlFlag(controlFlag);
-
- child = entry;
- if (trace)
- log.trace("newChild.AuthorizationInfo, policy-module code: " + code);
- }
-
- return child;
- }
-
- public Object newChild(AuthorizationModuleEntry entry, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.AppConfigurationEntryHolder, localName: " + localName);
- if ("module-option".equals(localName))
- {
- String name = attrs.getValue("name");
- child = new ModuleOption(name);
- if (trace)
- log.trace("newChild.AuthModuleEntry, module-option name: " + name);
- }
-
- return child;
- }
-
- public void addChild(ApplicationPolicy aPolicy, AuthorizationInfo authInfo, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- aPolicy.setAuthorizationInfo(authInfo);
- if (trace)
- log.trace("addChild.ApplicationPolicy, name: " + aPolicy.getName());
- }
-
- public void addChild(AuthorizationInfo authInfo, AuthorizationConfigEntryHolder entryInfo,
- UnmarshallingContext navigator, String namespaceURI, String localName)
- {
- AuthorizationModuleEntry entry = entryInfo.getEntry();
- authInfo.add(entry);
- if (trace)
- log.trace("addChild.AuthorizationInfo, name: " + entry.getPolicyModuleName());
- }
-
- public void addChild(AuthorizationConfigEntryHolder entryInfo, ModuleOption option, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- entryInfo.addOption(option);
- if (trace)
- log.trace("addChild.AuthorizationConfigEntryHolder, name: " + option.getName());
- }
-
- public void addChild(AuthorizationInfo authInfo, AuthorizationModuleEntry entry, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- authInfo.add(entry);
- }
-
- public void addChild(AuthorizationModuleEntry entry, ModuleOption option, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- entry.add(option);
- if (trace)
- log.trace("addChild.AuthorizationModuleEntry, name: " + option.getName());
- }
-
- // Instance-based authorization (ACL)
- public Object newChild(ACLInfo info, UnmarshallingContext navigator, String namespaceUri, String localName,
- Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.ACLInfo, localName: " + localName);
- if ("acl-module".equals(localName))
- {
- String code = attrs.getValue("code");
- code = StringPropertyReplacer.replaceProperties(code.trim());
-
- String flag = attrs.getValue("flag");
- if (flag == null)
- flag = "REQUIRED";
- flag = StringPropertyReplacer.replaceProperties(flag.trim());
-
- ControlFlag controlFlag = this.controlFlags.get(flag.toUpperCase());
- if (controlFlag == null)
- controlFlag = ControlFlag.REQUIRED;
-
- ACLProviderEntry entry = new ACLProviderEntry(code);
- entry.setControlFlag(controlFlag);
-
- child = entry;
- if (trace)
- log.trace("newChild.ACLInfo, acl-module code: " + code);
- }
-
- return child;
- }
-
- public Object newChild(ACLProviderEntry entry, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.ACLProviderEntry, localName: " + localName);
- if ("module-option".equals(localName))
- {
- String name = attrs.getValue("name");
- child = new ModuleOption(name);
- if (trace)
- log.trace("newChild.trustProviderEntry, module-option name: " + name);
- }
-
- return child;
- }
-
- public void addChild(ApplicationPolicy aPolicy, ACLInfo aclInfo, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- aPolicy.setAclInfo(aclInfo);
- if (trace)
- log.trace("Adding ACLInfo as a child of ApplicationPolicy " + aPolicy.getName());
- }
-
- public void addChild(ACLInfo aclInfo, ACLProviderEntry aclEntry, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- aclInfo.add(aclEntry);
- if (trace)
- log.trace("Adding ACLProviderEntry " + aclEntry.getAclProviderName() + " to ACLInfo " + aclInfo.getName());
- }
-
- public void addChild(ACLProviderEntry aclEntry, ModuleOption option, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- aclEntry.add(option);
- if (trace)
- log.trace("Adding module-option " + option.getName() + " to ACLProviderEntry " + aclEntry.getAclProviderName());
- }
-
- // Mapping
- public Object newChild(MappingInfo info, UnmarshallingContext navigator, String namespaceUri, String localName,
- Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.MappingInfo, localName: " + localName);
- if ("mapping-module".equals(localName))
- {
- String code = attrs.getValue("code");
- code = StringPropertyReplacer.replaceProperties(code.trim());
- String type = attrs.getValue("type");
- if(type != null)
- type = StringPropertyReplacer.replaceProperties(type.trim());
- else
- type = "role";
-
- child = new MappingModuleEntry(code, new HashMap<String,Object>(), type);
- if (trace)
- log.trace("newChild.MappingInfo, mapping-module code: " + code +
- ", mapping-module type: " + type);
- }
-
- return child;
- }
-
- public Object newChild(MappingModuleEntry entry, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.MappingModuleEntry, localName: " + localName);
- if ("module-option".equals(localName))
- {
- String name = attrs.getValue("name");
- child = new ModuleOption(name);
- if (trace)
- log.trace("newChild.MappingModuleEntry, module-option name: " + name);
- }
-
- return child;
- }
-
- public void addChild(ApplicationPolicy aPolicy, MappingInfo authInfo, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- // first organize the mapping modules by type.
- Map<String,List<MappingModuleEntry>> mappings = new HashMap<String,List<MappingModuleEntry>>();
- for(MappingModuleEntry entry : authInfo.getModuleEntries())
- {
- String type = entry.getMappingModuleType();
- if(mappings.containsKey(type))
- mappings.get(type).add(entry);
- else
- {
- List<MappingModuleEntry> entries = new ArrayList<MappingModuleEntry>();
- entries.add(entry);
- mappings.put(type, entries);
- }
- }
- // now set all mapping infos by type.
- for(Map.Entry<String,List<MappingModuleEntry>> entry : mappings.entrySet())
- {
- MappingInfo info = new MappingInfo(authInfo.getName());
- info.add(entry.getValue());
- aPolicy.setMappingInfo(entry.getKey(), info);
- }
- if (trace)
- log.trace("addChild.ApplicationPolicy, name: " + aPolicy.getName());
- }
-
- public void addChild(MappingModuleEntry entry, ModuleOption option, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- entry.add(option);
- if (trace)
- log.trace("addChild.MappingModuleEntry, name: " + option.getName());
- }
-
- public void addChild(MappingInfo authInfo, MappingModuleEntry entry, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- authInfo.add(entry);
- }
-
- // Audit Info
- public Object newChild(AuditInfo info, UnmarshallingContext navigator, String namespaceUri, String localName,
- Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.AuditInfo, localName: " + localName);
- if ("provider-module".equals(localName))
- {
- String code = attrs.getValue("code");
- code = StringPropertyReplacer.replaceProperties(code.trim());
- AuditProviderEntry entry = new AuditProviderEntry(code);
- child = entry;
- if (trace)
- log.trace("newChild.AuditInfo, provider-module code: " + code);
- }
-
- return child;
- }
-
- public Object newChild(AuditProviderEntry entry, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.AuditProviderEntry, localName: " + localName);
- if ("module-option".equals(localName))
- {
- String name = attrs.getValue("name");
- child = new ModuleOption(name);
- if (trace)
- log.trace("newChild.AuditProviderEntry, module-option name: " + name);
- }
-
- return child;
- }
-
- public void addChild(ApplicationPolicy aPolicy, AuditInfo auditInfo, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- aPolicy.setAuditInfo(auditInfo);
- if (trace)
- log.trace("addChild.ApplicationPolicy, name: " + aPolicy.getName());
- }
-
- public void addChild(AuditProviderEntry entry, ModuleOption option, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- entry.add(option);
- if (trace)
- log.trace("addChild.MappingModuleEntry, name: " + option.getName());
- }
-
- public void addChild(AuditInfo auditInfo, AuditProviderEntry entry, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- auditInfo.add(entry);
- }
-
- // Identity Trust
- public Object newChild(IdentityTrustInfo info, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.IdentityTrustInfo, localName: " + localName);
- if ("trust-module".equals(localName))
- {
- String code = attrs.getValue("code");
- code = StringPropertyReplacer.replaceProperties(code.trim());
-
- String flag = attrs.getValue("flag");
- if (flag == null)
- flag = "REQUIRED";
- flag = StringPropertyReplacer.replaceProperties(flag.trim());
-
- ControlFlag controlFlag = this.controlFlags.get(flag.toUpperCase());
- if (controlFlag == null)
- controlFlag = ControlFlag.REQUIRED;
-
- IdentityTrustModuleEntry entry = new IdentityTrustModuleEntry(code);
- entry.setControlFlag(controlFlag);
-
- child = entry;
- if (trace)
- log.trace("newChild.IdentityTrustInfo, trust-module code: " + code);
- }
-
- return child;
- }
-
- public Object newChild(IdentityTrustModuleEntry entry, UnmarshallingContext navigator, String namespaceUri,
- String localName, Attributes attrs)
- {
- Object child = null;
- if (trace)
- log.trace("newChild.trustProviderEntry, localName: " + localName);
- if ("module-option".equals(localName))
- {
- String name = attrs.getValue("name");
- child = new ModuleOption(name);
- if (trace)
- log.trace("newChild.trustProviderEntry, module-option name: " + name);
- }
-
- return child;
- }
-
- public void addChild(ApplicationPolicy aPolicy, IdentityTrustInfo auditInfo, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- aPolicy.setIdentityTrustInfo(auditInfo);
- if (trace)
- log.trace("addChild.ApplicationPolicy, name: " + aPolicy.getName());
- }
-
- public void addChild(IdentityTrustModuleEntry entry, ModuleOption option, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- entry.add(option);
- if (trace)
- log.trace("addChild.MappingModuleEntry, name: " + option.getName());
- }
-
- public void addChild(IdentityTrustInfo auditInfo, IdentityTrustModuleEntry entry, UnmarshallingContext navigator,
- String namespaceURI, String localName)
- {
- auditInfo.add(entry);
- }
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicyContainer.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicyContainer.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicyContainer.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,267 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.config;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.audit.config.AuditProviderEntry;
-import org.jboss.security.auth.container.config.AuthModuleEntry;
-import org.jboss.security.auth.login.AppConfigurationEntryHolder;
-import org.jboss.security.auth.login.AuthenticationInfo;
-import org.jboss.security.auth.login.BaseAuthenticationInfo;
-import org.jboss.security.auth.login.JASPIAuthenticationInfo;
-import org.jboss.security.auth.login.LoginModuleStackHolder;
-import org.jboss.security.authorization.config.AuthorizationConfigEntryHolder;
-import org.jboss.security.authorization.config.AuthorizationModuleEntry;
-import org.jboss.security.identitytrust.config.IdentityTrustModuleEntry;
-import org.jboss.xb.binding.GenericValueContainer;
-
-// $Id$
-
-/**
- * A container for creating ApplicationPolicy during jbxb parse.
- *
- * @author Anil.Saldhana at jboss.org
- * @version $Revision$
- */
-public class ApplicationPolicyContainer implements GenericValueContainer
-{
- private static Logger log = Logger.getLogger(ApplicationPolicyContainer.class);
-
- ApplicationPolicy info = null;
-
- String authName = null;
-
- String baseAppPolicyName = null;
-
- @SuppressWarnings("unchecked")
- List authenticationModuleEntries = new ArrayList();
-
- List<AuthorizationModuleEntry> authorizationModuleEntries = new ArrayList<AuthorizationModuleEntry>();
-
- List<AuditProviderEntry> auditProviderEntries = new ArrayList<AuditProviderEntry>();
-
- List<IdentityTrustModuleEntry> identityTrustModuleEntries = new ArrayList<IdentityTrustModuleEntry>();
-
- Map<String, LoginModuleStackHolder> loginModuleStackMap = new HashMap<String, LoginModuleStackHolder>();
-
- boolean isJASPIAuthentication = false;
-
- boolean isJAASAuthentication = false;
-
- boolean isAuthorization = false;
-
- boolean containsAudit = false;
-
- boolean containsIdentityTrust = false;
-
- boolean containsRoleMapping = false;
-
- // Mapping Info Object
- Map<String,MappingInfo> mappingInfos = new HashMap<String,MappingInfo>();
-
- ACLInfo aclInfo = null;
-
- AuditInfo auditInfo = null;
-
- IdentityTrustInfo identityTrustInfo = null;
-
- /**
- * @see GenericValueContainer#addChild(javax.xml.namespace.QName, java.lang.Object)
- */
- @SuppressWarnings("unchecked")
- public void addChild(QName name, Object value)
- {
- log.debug("addChild::" + name + ":" + value);
- if ("name".equals(name.getLocalPart()))
- {
- authName = (String) value;
- }
- else if ("extends".equals(name.getLocalPart()))
- {
- baseAppPolicyName = (String) value;
- }
- else if (value instanceof AppConfigurationEntryHolder)
- {
- AppConfigurationEntryHolder ace = (AppConfigurationEntryHolder) value;
- authenticationModuleEntries.add(ace.getEntry());
- isJAASAuthentication = true;
- }
- else if (value instanceof AppConfigurationEntry)
- {
- AppConfigurationEntry ace = (AppConfigurationEntry) value;
- authenticationModuleEntries.add(ace);
- isJAASAuthentication = true;
- }
- else if (value instanceof AuthModuleEntry)
- {
- AuthModuleEntry ame = (AuthModuleEntry) value;
- // Check if the authmodule needs a reference to a loginmodulestack
- String lmshName = ame.getLoginModuleStackHolderName();
- if (lmshName != null)
- ame.setLoginModuleStackHolder(loginModuleStackMap.get(lmshName));
- authenticationModuleEntries.add(ame);
- isJASPIAuthentication = true;
- }
- else if (value instanceof LoginModuleStackHolder)
- {
- LoginModuleStackHolder lmsh = (LoginModuleStackHolder) value;
- loginModuleStackMap.put(lmsh.getName(), lmsh);
- isJASPIAuthentication = true;
- }
- else if (value instanceof AuthorizationModuleEntry)
- {
- AuthorizationModuleEntry ame = (AuthorizationModuleEntry) value;
- if (!authorizationModuleEntries.contains(ame))
- authorizationModuleEntries.add(ame);
- isAuthorization = true;
- }
- else if (value instanceof AuthorizationConfigEntryHolder)
- {
- AuthorizationConfigEntryHolder ame = (AuthorizationConfigEntryHolder) value;
- AuthorizationModuleEntry ameEntry = ame.getEntry();
- if (!authorizationModuleEntries.contains(ameEntry))
- authorizationModuleEntries.add(ameEntry);
- isAuthorization = true;
- }
- else if (value instanceof AuditProviderEntry)
- {
- AuditProviderEntry ameEntry = (AuditProviderEntry) value;
- if (!auditProviderEntries.contains(ameEntry))
- auditProviderEntries.add(ameEntry);
- containsAudit = true;
- }
- else if (value instanceof IdentityTrustModuleEntry)
- {
- IdentityTrustModuleEntry ameEntry = (IdentityTrustModuleEntry) value;
- if (!identityTrustModuleEntries.contains(ameEntry))
- identityTrustModuleEntries.add(ameEntry);
- containsIdentityTrust = true;
- }
- }
-
- /**
- * Mapping Objects are added to the Application Policy
- *
- * @param obj
- */
- @SuppressWarnings("unchecked")
- public void addMappingInfo(Object obj)
- {
- log.debug(obj);
- if (obj instanceof Map)
- {
- this.mappingInfos.putAll((Map) obj);
- for(MappingInfo info: this.mappingInfos.values())
- info.setName(authName);
- this.containsRoleMapping = true;
- }
- }
-
- /**
- * <p>
- * Adds the {@code ACLInfo} object constructed by the XB parse to the application policy.
- * </p>
- *
- * @param info a reference to the {@code ACLInfo} being added.
- */
- public void addACLInfo(Object info)
- {
- if (info instanceof ACLInfo)
- {
- this.aclInfo = (ACLInfo) info;
- this.aclInfo.setName(this.authName);
- }
- }
-
- /**
- * @see GenericValueContainer#instantiate()
- */
- @SuppressWarnings("unchecked")
- public Object instantiate()
- {
- info = new ApplicationPolicy(authName);
- if (baseAppPolicyName != null)
- info.setBaseApplicationPolicyName(baseAppPolicyName);
-
- BaseAuthenticationInfo binfo = null;
- AuthorizationInfo ainfo = null;
-
- if (isJAASAuthentication)
- {
- binfo = new AuthenticationInfo(authName);
- SecurityActions.addModules(binfo, authenticationModuleEntries);
- info.setAuthenticationInfo(binfo);
- }
- if (isJASPIAuthentication)
- {
- JASPIAuthenticationInfo jaspiInfo = new JASPIAuthenticationInfo(authName);
- SecurityActions.addModules(jaspiInfo, authenticationModuleEntries);
- for (LoginModuleStackHolder holder : this.loginModuleStackMap.values())
- jaspiInfo.add(holder);
- info.setAuthenticationInfo(jaspiInfo);
- }
- if (isAuthorization)
- {
- ainfo = new AuthorizationInfo(authName);
- SecurityActions.addModules(ainfo, authorizationModuleEntries);
- info.setAuthorizationInfo(ainfo);
- }
- if (this.aclInfo != null)
- {
- info.setAclInfo(this.aclInfo);
- }
- if (containsRoleMapping)
- {
- for(String type : this.mappingInfos.keySet())
- info.setMappingInfo(type, this.mappingInfos.get(type));
- }
- if (containsAudit)
- {
- auditInfo = new AuditInfo(authName);
- SecurityActions.addModules(auditInfo, auditProviderEntries);
- info.setAuditInfo(auditInfo);
- }
- if (containsIdentityTrust)
- {
- identityTrustInfo = new IdentityTrustInfo(authName);
- SecurityActions.addModules(identityTrustInfo, identityTrustModuleEntries);
- info.setIdentityTrustInfo(identityTrustInfo);
- }
- return info;
- }
-
- /**
- * @see GenericValueContainer#getTargetClass()
- */
- public Class<?> getTargetClass()
- {
- return ApplicationPolicy.class;
- }
-}
Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationJASPIConfigParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationJASPIConfigParser.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/AuthenticationJASPIConfigParser.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -53,139 +53,146 @@
* @throws XMLStreamException
*/
public JASPIAuthenticationInfo parse(XMLEventReader xmlEventReader) throws XMLStreamException
- {
- JASPIAuthenticationInfo authInfo = new JASPIAuthenticationInfo();
+ {
+ JASPIAuthenticationInfo authInfo = new JASPIAuthenticationInfo();
+ Map<String, LoginModuleStackHolder> holders = new HashMap<String, LoginModuleStackHolder>();
+ while (xmlEventReader.hasNext())
+ {
+ XMLEvent xmlEvent = xmlEventReader.peek();
- LoginModuleStackHolder lmsh = null;
- while(xmlEventReader.hasNext())
- {
- XMLEvent xmlEvent = xmlEventReader.peek();
-
StartElement peekedStartElement = (StartElement) xmlEvent;
- String peekedStartElementName = StaxParserUtil.getStartElementName(peekedStartElement);
- if("login-module-stack".equals(peekedStartElementName))
+ String peekedStartElementName = StaxParserUtil.getStartElementName(peekedStartElement);
+ if ("login-module-stack".equals(peekedStartElementName))
{
StartElement lmshEvent = (StartElement) xmlEventReader.nextEvent();
Attribute nameAttribute = (Attribute) lmshEvent.getAttributes().next();
String nameAttributeValue = StaxParserUtil.getAttributeValue(nameAttribute);
- lmsh = new LoginModuleStackHolder(nameAttributeValue, null);
- authInfo.add(lmsh);
-
- while(true)
+ LoginModuleStackHolder holder = new LoginModuleStackHolder(nameAttributeValue, null);
+ holders.put(nameAttributeValue, holder);
+ authInfo.add(holder);
+
+ while (true)
{
//Get all the login modules
xmlEvent = xmlEventReader.peek();
peekedStartElement = (StartElement) xmlEvent;
peekedStartElementName = StaxParserUtil.getStartElementName(peekedStartElement);
- if("login-module".equals(peekedStartElementName))
+ if ("login-module".equals(peekedStartElementName))
{
- lmsh.addAppConfigurationEntry(this.getJAASEntry(xmlEventReader) );
- }
+ holder.addAppConfigurationEntry(this.getJAASEntry(xmlEventReader));
+ }
else
break;
}
}
- else if("auth-module".equals(peekedStartElementName))
+ else if ("auth-module".equals(peekedStartElementName))
{
AuthModuleEntry entry = getJaspiEntry(xmlEventReader);
- if(lmsh != null)
- entry.setLoginModuleStackHolder(lmsh);
-
+ String stackHolderRefName = entry.getLoginModuleStackHolderName();
+ if (stackHolderRefName != null)
+ {
+ if (holders.containsKey(stackHolderRefName) == false)
+ throw new RuntimeException("auth-module references a login module stack that doesn't exist: "
+ + stackHolderRefName);
+ entry.setLoginModuleStackHolder(holders.get(stackHolderRefName));
+ }
authInfo.add(entry);
}
- else break;
-
+ else
+ break;
+
}
return authInfo;
}
-
+
@SuppressWarnings("unchecked")
private AppConfigurationEntry getJAASEntry(XMLEventReader xmlEventReader) throws XMLStreamException
{
- XMLEvent xmlEvent = xmlEventReader.nextEvent();
- Map<String, Object> options = new HashMap<String,Object>();
-
-
+ XMLEvent xmlEvent = xmlEventReader.nextEvent();
+ Map<String, Object> options = new HashMap<String, Object>();
+
String codeName = null;
LoginModuleControlFlag controlFlag = LoginModuleControlFlag.REQUIRED;
-
+
//We got the login-module element
StartElement loginModuleElement = (StartElement) xmlEvent;
//We got the login-module element
Iterator<Attribute> attrs = loginModuleElement.getAttributes();
- while(attrs.hasNext())
+ while (attrs.hasNext())
{
Attribute attribute = attrs.next();
-
QName attQName = attribute.getName();
String attributeValue = StaxParserUtil.getAttributeValue(attribute);
-
- if("code".equals(attQName.getLocalPart()))
+
+ if ("code".equals(attQName.getLocalPart()))
{
codeName = attributeValue;
}
- else if("flag".equals(attQName.getLocalPart()))
+ else if ("flag".equals(attQName.getLocalPart()))
{
controlFlag = getControlFlag(attributeValue);
- }
- }
+ }
+ }
//See if there are options
ModuleOptionParser moParser = new ModuleOptionParser();
options.putAll(moParser.parse(xmlEventReader));
-
- return new AppConfigurationEntry(codeName, controlFlag, options);
+
+ return new AppConfigurationEntry(codeName, controlFlag, options);
}
-
+
@SuppressWarnings("unchecked")
private AuthModuleEntry getJaspiEntry(XMLEventReader xmlEventReader) throws XMLStreamException
{
- XMLEvent xmlEvent = xmlEventReader.nextEvent();
- Map<String, Object> options = new HashMap<String,Object>();
-
-
+ XMLEvent xmlEvent = xmlEventReader.nextEvent();
+ Map<String, Object> options = new HashMap<String, Object>();
+
String codeName = null;
+ String loginModuleStackRef = null;
ControlFlag flag = ControlFlag.REQUIRED;
-
+
//We got the login-module element
StartElement authModuleElement = (StartElement) xmlEvent;
//We got the login-module element
Iterator<Attribute> attrs = authModuleElement.getAttributes();
- while(attrs.hasNext())
+ while (attrs.hasNext())
{
Attribute attribute = attrs.next();
-
+
QName attQName = attribute.getName();
String attributeValue = StaxParserUtil.getAttributeValue(attribute);
-
- if("code".equals(attQName.getLocalPart()))
+
+ if ("code".equals(attQName.getLocalPart()))
{
- codeName = attributeValue;
+ codeName = attributeValue;
}
- else if("flag".equals(attQName.getLocalPart()))
+ else if ("flag".equals(attQName.getLocalPart()))
{
flag = ControlFlag.valueOf(attributeValue);
- }
- }
-
+ }
+ else if ("login-module-stack-ref".equals(attQName.getLocalPart()))
+ {
+ loginModuleStackRef = attributeValue;
+ }
+ }
+
//See if there are options
ModuleOptionParser moParser = new ModuleOptionParser();
- options.putAll(moParser.parse(xmlEventReader));
-
- AuthModuleEntry entry = new AuthModuleEntry(codeName, options, null);
+ options.putAll(moParser.parse(xmlEventReader));
+
+ AuthModuleEntry entry = new AuthModuleEntry(codeName, options, loginModuleStackRef);
entry.setControlFlag(flag);
return entry;
- }
-
-
+ }
+
private LoginModuleControlFlag getControlFlag(String flag)
{
- if("required".equalsIgnoreCase(flag))
+ if ("required".equalsIgnoreCase(flag))
return LoginModuleControlFlag.REQUIRED;
- if("sufficient".equalsIgnoreCase(flag))
+ if ("sufficient".equalsIgnoreCase(flag))
return LoginModuleControlFlag.SUFFICIENT;
- if("optional".equalsIgnoreCase(flag))
+ if ("optional".equalsIgnoreCase(flag))
return LoginModuleControlFlag.OPTIONAL;
- if("requisite".equalsIgnoreCase(flag))
+ if ("requisite".equalsIgnoreCase(flag))
return LoginModuleControlFlag.REQUISITE;
throw new RuntimeException(flag + " is not recognized");
}
Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/IdentityTrustConfigParser.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/IdentityTrustConfigParser.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/config/parser/IdentityTrustConfigParser.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -34,6 +34,7 @@
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
+import org.jboss.security.config.ControlFlag;
import org.jboss.security.identitytrust.config.IdentityTrustModuleEntry;
/**
@@ -76,6 +77,7 @@
Map<String, Object> options = new HashMap<String,Object>();
String codeName = null;
+ ControlFlag flag = null;
//We got the login-module element
StartElement policyModuleElement = (StartElement) xmlEvent;
@@ -91,13 +93,18 @@
if("code".equals(attQName.getLocalPart()))
{
codeName = attributeValue;
- }
+ }
+ if ("flag".equals(attQName.getLocalPart()))
+ {
+ flag = ControlFlag.valueOf(attributeValue);
+ }
}
//See if there are options
ModuleOptionParser moParser = new ModuleOptionParser();
options.putAll(moParser.parse(xmlEventReader));
IdentityTrustModuleEntry entry = new IdentityTrustModuleEntry(codeName, options);
+ entry.setControlFlag(flag);
return entry;
}
}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/identitytrust/config/IdentityTrustConfigEntryHolder.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/identitytrust/config/IdentityTrustConfigEntryHolder.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/identitytrust/config/IdentityTrustConfigEntryHolder.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,78 +0,0 @@
-/*
- * 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.identitytrust.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.security.config.ModuleOption;
-import org.jboss.xb.binding.GenericValueContainer;
-
-//$Id$
-
-/**
- * A container for creating AuditConfigEntry during jbxb parse
- * @author Anil.Saldhana at redhat.com
- * @since Aug 14, 2007
- * @version $Revision$
- */
-public class IdentityTrustConfigEntryHolder implements GenericValueContainer
-{
- private Map<String,Object> moduleOptions = new HashMap<String,Object>();
- String moduleName = null;
-
- public void addChild(QName name, Object value)
- {
- if("code".equals(name.getLocalPart()))
- {
- moduleName = (String)value;
- }
- if(value instanceof ModuleOption)
- {
- ModuleOption mo = (ModuleOption)value;
- moduleOptions.put(mo.getName(),mo.getValue());
- }
- }
-
- public void addOption(ModuleOption option)
- {
- moduleOptions.put(option.getName(), option.getValue());
- }
-
- public IdentityTrustModuleEntry getEntry()
- {
- return (IdentityTrustModuleEntry)instantiate();
- }
-
- public Object instantiate()
- {
- IdentityTrustModuleEntry entry = new IdentityTrustModuleEntry( moduleName,moduleOptions );
- return entry;
- }
-
- public Class<?> getTargetClass()
- {
- return IdentityTrustModuleEntry.class;
- }
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/config/MappingConfigContainer.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/config/MappingConfigContainer.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/config/MappingConfigContainer.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.mapping.config;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.config.MappingInfo;
-import org.jboss.xb.binding.GenericValueContainer;
-
-// $Id: RoleMappingConfigContainer.java 45942 2006-06-28 02:14:46Z asaldhana $
-
-/**
- * A container for creating RoleMappingConfig during jbxb parse.
- *
- * @author Anil.Saldhana at jboss.org
- * @version $Revision: 45942 $
- */
-public class MappingConfigContainer implements GenericValueContainer
-{
- private static Logger MappingConfigContainer = Logger.getLogger(MappingConfigContainer.class);
-
- private final Map<String, List<MappingModuleEntry>> moduleEntries = new HashMap<String, List<MappingModuleEntry>>();
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#addChild(javax.xml.namespace.QName, java.lang.Object)
- */
- public void addChild(QName name, Object value)
- {
- if (MappingConfigContainer.isTraceEnabled())
- MappingConfigContainer.trace("addChild:Qname=" + name + ":value=" + value);
- if (value instanceof MappingModuleEntry)
- {
- MappingModuleEntry mme = (MappingModuleEntry) value;
- String type = mme.getMappingModuleType();
- // organize the mapping modules in groups according to their type.
- if (this.moduleEntries.containsKey(type))
- {
- this.moduleEntries.get(type).add(mme);
- }
- else
- {
- List<MappingModuleEntry> entries = new ArrayList<MappingModuleEntry>();
- entries.add(mme);
- this.moduleEntries.put(type, entries);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#instantiate()
- */
- public Object instantiate()
- {
- Map<String, MappingInfo> infos = new HashMap<String, MappingInfo>();
-
- // create a MappingInfo instance of each group of mapping modules.
- for (String type : this.moduleEntries.keySet())
- {
- // application policy name will be reset in ApplicationPolicyContainer.
- MappingInfo mapping = new MappingInfo("dummy");
- mapping.add(this.moduleEntries.get(type));
- infos.put(type, mapping);
- }
- return infos;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.xb.binding.GenericValueContainer#getTargetClass()
- */
- public Class<?> getTargetClass()
- {
- return MappingInfo.class;
- }
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/config/MappingConfigEntryHolder.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/config/MappingConfigEntryHolder.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/config/MappingConfigEntryHolder.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.mapping.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.security.config.ModuleOption;
-import org.jboss.security.mapping.MappingType;
-import org.jboss.xb.binding.GenericValueContainer;
-
-//$Id: MappingConfigEntryHolder.java 46201 2006-07-11 17:51:23Z asaldhana $
-
-/**
- * A container for creating MappingConfigEntry during jbxb parse.
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since August 26, 2006
- * @version $Revision: 46201 $
- */
-public class MappingConfigEntryHolder implements GenericValueContainer
-{
- private final Map<String,Object> moduleOptions = new HashMap<String,Object>();
- String moduleName = null;
- String type = MappingType.ROLE.toString();
-
- public void addChild(QName name, Object value)
- {
- if("code".equals(name.getLocalPart()))
- {
- moduleName = (String)value;
- }
- else if("type".equals(name.getLocalPart()))
- {
- this.type = (String) value;
- }
- if(value instanceof ModuleOption)
- {
- ModuleOption mo = (ModuleOption)value;
- moduleOptions.put(mo.getName(),mo.getValue());
- }
- }
-
- public void addOption(ModuleOption option)
- {
- moduleOptions.put(option.getName(), option.getValue());
- }
-
- public MappingModuleEntry getEntry()
- {
- return (MappingModuleEntry)instantiate();
- }
-
- public Object instantiate()
- {
- MappingModuleEntry entry = new MappingModuleEntry(this.moduleName, this.moduleOptions, this.type);
- return entry;
- }
-
- public Class<?> getTargetClass()
- {
- return MappingModuleEntry.class;
- }
-
-}
\ No newline at end of file
Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -49,14 +49,10 @@
import org.jboss.security.SecurityRolesAssociation;
import org.jboss.security.SecurityUtil;
import org.jboss.security.SimplePrincipal;
-import org.jboss.security.acl.ACLContext;
import org.jboss.security.authorization.AuthorizationContext;
import org.jboss.security.authorization.AuthorizationException;
-import org.jboss.security.authorization.EntitlementHolder;
-import org.jboss.security.authorization.Permission;
import org.jboss.security.authorization.Resource;
import org.jboss.security.callbacks.SecurityContextCallback;
-import org.jboss.security.identity.Identity;
import org.jboss.security.identity.Role;
import org.jboss.security.identity.RoleGroup;
import org.jboss.security.identity.plugins.SimpleRole;
@@ -64,7 +60,6 @@
import org.jboss.security.mapping.MappingContext;
import org.jboss.security.mapping.MappingManager;
import org.jboss.security.mapping.MappingType;
-import org.jboss.security.plugins.acl.JBossACLContext;
import org.jboss.security.plugins.authorization.JBossAuthorizationContext;
//$Id$
@@ -86,8 +81,6 @@
private AuthorizationContext authorizationContext = null;
- private ACLContext aclContext = null;
-
//Lock deals with synchronization of authorizationContext usage
private final Lock lock = new ReentrantLock();
@@ -135,33 +128,6 @@
return internalAuthorization(resource, subject, getRoleGroup(roleGroup));
}
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.security.AuthorizationManager#authorize(org.jboss.security.authorization.Resource,
- * org.jboss.security.identity.Identity, org.jboss.security.authorization.Permission)
- */
- public int authorize(Resource resource, Identity identity, Permission permission)
- throws AuthorizationException
- {
- if(this.aclContext == null)
- this.aclContext = new JBossACLContext(this.securityDomain);
- return aclContext.authorize(resource, identity, permission);
- }
-
- /**
- * @see AuthorizationManager#entitlements(Class, Resource, Identity)
- */
- public <T> EntitlementHolder<T> getEntitlements(Class<T> clazz,
- Resource resource, Identity identity)
- throws AuthorizationException
- {
- if(this.aclContext == null)
- this.aclContext = new JBossACLContext(this.securityDomain);
- return aclContext.getEntitlements(clazz, resource, identity);
- }
-
-
/** Does the current Subject have a role(a Principal) that equates to one
of the role names. This method obtains the Group named 'Roles' from
the principal set of the currently authenticated Subject as determined
Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -32,10 +32,6 @@
import javax.xml.bind.JAXBElement;
import org.jboss.logging.Logger;
-import org.jboss.security.acl.ACL;
-import org.jboss.security.acl.ACLImpl;
-import org.jboss.security.acl.config.ACLConfiguration;
-import org.jboss.security.acl.config.ACLConfigurationFactory;
import org.jboss.security.authorization.PolicyRegistration;
import org.jboss.security.xacml.core.JBossPDP;
import org.jboss.security.xacml.factories.PolicyFactory;
@@ -64,12 +60,6 @@
*/
private final Map<String, JBossPDP> contextIDToJBossPDP = new HashMap<String, JBossPDP>();
- /** Map to keep track of the ACLs that have been configured in each context. */
- private final Map<String, Set<ACL>> contextIDToACLs = new HashMap<String, Set<ACL>>();
-
- /** Global map that keeps all the configured ACLs keyed by their resource */
- private final Map<String, ACL> configuredACLs = new HashMap<String, ACL>();
-
public void deRegisterPolicy(String contextID, String type)
{
if (PolicyRegistration.XACML.equalsIgnoreCase(type))
@@ -78,20 +68,6 @@
if (trace)
log.trace("DeRegistered policy for contextId:" + contextID + ":type=" + type);
}
- else if (PolicyRegistration.ACL.equalsIgnoreCase(type))
- {
- Set<ACL> acls = this.contextIDToACLs.remove(contextID);
- if (acls != null)
- {
- for (ACL acl : acls)
- {
- ACLImpl impl = (ACLImpl) acl;
- this.configuredACLs.remove(impl.getResourceAsString());
- }
- }
- if (trace)
- log.trace("Deregistered ACLs for contextId:" + contextID);
- }
}
@SuppressWarnings("unchecked")
@@ -107,24 +83,6 @@
}
return (T) this.contextIdToXACMLPolicy.get(contextID);
}
- else if (PolicyRegistration.ACL.equalsIgnoreCase(type))
- {
- if (contextMap != null)
- {
- String query = (String) contextMap.get("resource");
- if ("ALL".equalsIgnoreCase(query))
- {
- // return all the ACLs that have been registered.
- return (T) this.configuredACLs.values();
- }
- else if (query != null)
- {
- // we are looking for an ACL for an specific resource.
- return (T) this.configuredACLs.get(query);
- }
- }
- return (T) this.contextIDToACLs.get(contextID);
- }
throw new RuntimeException("Unsupported type:" + type);
}
@@ -171,22 +129,6 @@
log.debug("Error in registering xacml policy:", e);
}
}
- else if (PolicyRegistration.ACL.equalsIgnoreCase(type))
- {
- ACLConfiguration configuration = ACLConfigurationFactory.getConfiguration(stream);
- if(configuration == null)
- throw new IllegalStateException("ACL Configuration is null");
- 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);
- }
- }
}
/**
@@ -211,23 +153,6 @@
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);
- }
- }
}
/**
Deleted: trunk/security-jboss-sx/jbosssx/src/main/resources/schema/jboss-acl-config_1_0.xsd
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/resources/schema/jboss-acl-config_1_0.xsd 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/main/resources/schema/jboss-acl-config_1_0.xsd 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,62 +0,0 @@
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:jbsx="urn:jboss:jboss-acl-config:1.0"
- xmlns="urn:jboss:jboss-acl-config:1.0"
- xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
- targetNamespace="urn:jboss:jboss-acl-config:1.0"
- elementFormDefault="qualified"
- attributeFormDefault="unqualified">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:schemaBindings>
- <jbxb:package name="org.jboss.security.acl.config"/>
- <jbxb:ignoreUnresolvedFieldOrClass>false</jbxb:ignoreUnresolvedFieldOrClass>
- </jbxb:schemaBindings>
- </xsd:appinfo>
- </xsd:annotation>
-
- <xsd:element name="jboss-acl" type="jbsx:ACLConfiguration"/>
- <xsd:complexType name="ACLConfiguration">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.security.acl.config.ACLConfiguration"/>
- </xsd:appinfo>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element ref="jbsx:acl-definition" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:element name="acl-definition">
- <xsd:complexType>
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.security.acl.config.ACLDefinition"/>
- <jbxb:addMethod name="addDefinition"/>
- </xsd:appinfo>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element ref="jbsx:entry" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="resource" type="xsd:string" use="required"/>
- <xsd:attribute name="extends" type="xsd:string" use="optional"/>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="entry" type="jbsx:entryType"/>
- <xsd:complexType name="entryType">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.security.acl.config.ACLEntryHolder"/>
- <jbxb:addMethod name="addACLEntry"/>
- </xsd:appinfo>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element ref="jbsx:identity-name" minOccurs="1" maxOccurs="1"/>
- <xsd:element ref="jbsx:permissions" minOccurs="1" maxOccurs="1"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:element name="identity-name" type="xsd:string"/>
- <xsd:element name="permissions" type="xsd:string"/>
-
-</xsd:schema>
Modified: trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authentication/jaspi/AuthContextUnitTestCase.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authentication/jaspi/AuthContextUnitTestCase.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authentication/jaspi/AuthContextUnitTestCase.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -23,7 +23,6 @@
import java.io.IOException;
-import java.io.InputStreamReader;
import java.net.URL;
import java.security.Principal;
@@ -31,6 +30,7 @@
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.Configuration;
import junit.extensions.TestSetup;
import junit.framework.Test;
@@ -38,18 +38,13 @@
import org.jboss.security.SecurityContext;
import org.jboss.security.SecurityContextAssociation;
+import org.jboss.security.auth.login.XMLLoginConfigImpl;
import org.jboss.security.auth.message.GenericMessageInfo;
-import org.jboss.security.auth.spi.UsersObjectModelFactory;
-import org.jboss.security.authorization.config.SecurityConfigObjectModelFactory;
-import org.jboss.security.config.ApplicationPolicy;
-import org.jboss.security.config.PolicyConfig;
-import org.jboss.security.config.SecurityConfiguration;
+import org.jboss.security.config.parser.StaxBasedConfigParser;
import org.jboss.security.plugins.JBossSecurityContext;
import org.jboss.security.plugins.auth.JASPIServerAuthenticationManager;
import org.jboss.test.JBossTestCase;
import org.jboss.test.JBossTestSetup;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
/**
@@ -61,14 +56,11 @@
*/
public class AuthContextUnitTestCase extends JBossTestCase
{
- private static PolicyConfig policyConfig = null;
-
public AuthContextUnitTestCase(String name)
{
super(name);
}
-
public static Test suite() throws Exception
{
TestSuite suite = new TestSuite();
@@ -83,10 +75,8 @@
URL url = tcl.getResource("config/jaspi-config-options.xml");
if(url == null)
throw new IllegalStateException("config url is null");
+ Configuration.setConfiguration(XMLLoginConfigImpl.getInstance());
loadXMLConfig(url);
-
- for(ApplicationPolicy policy : policyConfig.getPolicies())
- SecurityConfiguration.addApplicationPolicy(policy);
}
protected void tearDown() throws Exception
{
@@ -102,7 +92,6 @@
*/
public void testRequiredOptionBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
boolean result = getResult("required-permit-policy");
assertTrue("PERMIT?", true == result);
result = getResult("required-deny-policy");
@@ -114,7 +103,6 @@
*/
public void testRequisiteOptionBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
boolean result = getResult("requisite-permit-policy");
assertTrue("PERMIT?", true == result);
result = getResult("requisite-deny-policy");
@@ -127,7 +115,6 @@
*/
public void testSufficientOptionBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
boolean result = getResult("sufficient-permit-policy");
assertTrue("PERMIT?", true == result);
result = getResult("sufficient-deny-policy");
@@ -140,7 +127,6 @@
*/
public void testOptionalOptionBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
boolean result = getResult("optional-permit-policy");
assertTrue("PERMIT?", true == result);
result = getResult("optional-deny-policy");
@@ -152,7 +138,6 @@
*/
public void testCombinationBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
boolean result = getResult("required-deny-sufficient-permit-policy");
assertTrue("DENY?", false == result);
result = getResult("required-permit-sufficient-deny-policy");
@@ -206,13 +191,7 @@
{
if(loginConfigURL == null)
throw new IllegalArgumentException("loginConfigURL is null");
- SecurityConfigObjectModelFactory lcomf = new SecurityConfigObjectModelFactory();
- UsersObjectModelFactory uomf = new UsersObjectModelFactory();
-
- InputStreamReader xmlReader = new InputStreamReader(loginConfigURL.openStream());
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.mapFactoryToNamespace(uomf, "http://www.jboss.org/j2ee/schemas/XMLLoginModule");
- policyConfig = (PolicyConfig) unmarshaller.unmarshal(xmlReader, lcomf, (Object)null);
+ new StaxBasedConfigParser().parse(loginConfigURL.openStream());
}
/**
Modified: trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authorization/AuthorizationContextUnitTestCase.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authorization/AuthorizationContextUnitTestCase.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authorization/AuthorizationContextUnitTestCase.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -23,7 +23,6 @@
import java.io.IOException;
-import java.io.InputStreamReader;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -32,29 +31,26 @@
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.Configuration;
import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.jboss.security.auth.spi.UsersObjectModelFactory;
+import org.jboss.security.auth.login.XMLLoginConfigImpl;
import org.jboss.security.authorization.AuthorizationContext;
import org.jboss.security.authorization.AuthorizationException;
import org.jboss.security.authorization.Resource;
import org.jboss.security.authorization.ResourceType;
-import org.jboss.security.authorization.config.SecurityConfigObjectModelFactory;
-import org.jboss.security.config.PolicyConfig;
+import org.jboss.security.config.ApplicationPolicyRegistration;
+import org.jboss.security.config.parser.StaxBasedConfigParser;
import org.jboss.security.plugins.authorization.JBossAuthorizationContext;
import org.jboss.test.JBossTestCase;
import org.jboss.test.JBossTestSetup;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
public class AuthorizationContextUnitTestCase extends JBossTestCase
{
- private static PolicyConfig policyConfig = null;
-
public AuthorizationContextUnitTestCase(String name)
{
super(name);
@@ -75,6 +71,7 @@
URL url = tcl.getResource("authorization/config/authorization-policy.xml");
if(url == null)
throw new IllegalStateException("config url is null");
+ Configuration.setConfiguration(XMLLoginConfigImpl.getInstance());
loadXMLConfig(url);
}
protected void tearDown() throws Exception
@@ -91,7 +88,6 @@
*/
public void testRequiredOptionBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
int result = getResult("required-permit-policy");
assertTrue("PERMIT?", AuthorizationContext.PERMIT == result);
result = getResult("required-deny-policy");
@@ -103,7 +99,6 @@
*/
public void testRequisiteOptionBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
int result = getResult("requisite-permit-policy");
assertTrue("PERMIT?", AuthorizationContext.PERMIT == result);
result = getResult("requisite-deny-policy");
@@ -116,7 +111,6 @@
*/
public void testSufficientOptionBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
int result = getResult("sufficient-permit-policy");
assertTrue("PERMIT?", AuthorizationContext.PERMIT == result);
result = getResult("sufficient-deny-policy");
@@ -129,7 +123,6 @@
*/
public void testOptionalOptionBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
int result = getResult("optional-permit-policy");
assertTrue("PERMIT?", AuthorizationContext.PERMIT == result);
result = getResult("optional-deny-policy");
@@ -141,7 +134,6 @@
*/
public void testCombinationBehavior() throws Exception
{
- assertNotNull("PolicyConfig != null", policyConfig);
int result = getResult("required-deny-sufficient-permit-policy");
assertTrue("DENY?", AuthorizationContext.DENY == result);
result = getResult("required-permit-sufficient-deny-policy");
@@ -176,10 +168,15 @@
{
int result = AuthorizationContext.DENY;
+ Configuration config = Configuration.getConfiguration();
+ if(config instanceof ApplicationPolicyRegistration == false)
+ throw new IllegalStateException("JAAS Configuration does not support application policy registration");
+ ApplicationPolicyRegistration appPolicyRegistration = (ApplicationPolicyRegistration) config;
+
JBossAuthorizationContext aContext = new JBossAuthorizationContext(policyName,
new Subject(),
new TestCallbackHandler());
- aContext.setApplicationPolicy(policyConfig.get(policyName));
+ aContext.setApplicationPolicy(appPolicyRegistration.getApplicationPolicy(policyName));
try
{
result = aContext.authorize(new Resource()
@@ -220,13 +217,7 @@
{
if(loginConfigURL == null)
throw new IllegalArgumentException("loginConfigURL is null");
- SecurityConfigObjectModelFactory lcomf = new SecurityConfigObjectModelFactory();
- UsersObjectModelFactory uomf = new UsersObjectModelFactory();
-
- InputStreamReader xmlReader = new InputStreamReader(loginConfigURL.openStream());
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.mapFactoryToNamespace(uomf, "http://www.jboss.org/j2ee/schemas/XMLLoginModule");
- policyConfig = (PolicyConfig) unmarshaller.unmarshal(xmlReader, lcomf, (Object)null);
+ new StaxBasedConfigParser().parse(loginConfigURL.openStream());
}
/**
Deleted: trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/security/config/JBossXBSchemaBindingUnitTestCase.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/security/config/JBossXBSchemaBindingUnitTestCase.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/security/config/JBossXBSchemaBindingUnitTestCase.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,59 +0,0 @@
-/*
- * 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.test.security.config;
-
-import org.jboss.security.config.PolicyConfig;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
-
-//$Id$
-
-/**
- * Validate JBossXB SchemaBinding
- * @author Anil.Saldhana at redhat.com
- * @since Aug 14, 2007
- * @version $Revision$
- */
-public class JBossXBSchemaBindingUnitTestCase extends SecurityConfigurationUnitTestCase
-{
-
- public JBossXBSchemaBindingUnitTestCase(String name)
- {
- super(name);
- }
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- // **** UNCOMMENT TO ENABLE TRACE ***
- //this.enableTrace("org.jboss.xb.binding.sunday.unmarshalling.XsdBinder");
-
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
- SchemaBinding schema = XsdBinder.bind(tcl.getResourceAsStream(schemaFile), null);
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- config = (PolicyConfig) unmarshaller.unmarshal(tcl.getResourceAsStream(xmlFile), schema);
- assertNotNull(config);
- }
-}
Deleted: trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/security/config/SecurityConfigurationUnitTestCase.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/security/config/SecurityConfigurationUnitTestCase.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/security/config/SecurityConfigurationUnitTestCase.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,366 +0,0 @@
-/*
- * 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.test.security.config;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-import javax.security.auth.login.AppConfigurationEntry;
-
-import junit.framework.Assert;
-
-import org.jboss.security.acl.config.ACLProviderEntry;
-import org.jboss.security.audit.config.AuditProviderEntry;
-import org.jboss.security.auth.container.config.AuthModuleEntry;
-import org.jboss.security.auth.login.BaseAuthenticationInfo;
-import org.jboss.security.auth.login.LoginConfigObjectModelFactory;
-import org.jboss.security.auth.login.LoginModuleStackHolder;
-import org.jboss.security.auth.spi.UsersObjectModelFactory;
-import org.jboss.security.authorization.config.AuthorizationModuleEntry;
-import org.jboss.security.authorization.config.SecurityConfigObjectModelFactory;
-import org.jboss.security.config.ACLInfo;
-import org.jboss.security.config.ApplicationPolicy;
-import org.jboss.security.config.AuditInfo;
-import org.jboss.security.config.AuthorizationInfo;
-import org.jboss.security.config.ControlFlag;
-import org.jboss.security.config.IdentityTrustInfo;
-import org.jboss.security.config.MappingInfo;
-import org.jboss.security.config.PolicyConfig;
-import org.jboss.security.config.SecurityConfiguration;
-import org.jboss.security.identitytrust.config.IdentityTrustModuleEntry;
-import org.jboss.security.mapping.MappingType;
-import org.jboss.security.mapping.config.MappingModuleEntry;
-import org.jboss.test.AbstractJBossSXTest;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-/**
- * Security Configuration Unit Test Case
- *
- * @author Anil.Saldhana at redhat.com
- * @since Jul 25, 2007
- * @version $Revision$
- */
-public class SecurityConfigurationUnitTestCase extends AbstractJBossSXTest
-{
- protected String schemaFile = "schema/security-config_5_0.xsd";
-
- protected String xmlFile = "config/securityConfig5.xml";
-
- protected PolicyConfig config = null;
-
- public SecurityConfigurationUnitTestCase(String name)
- {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
-
- LoginConfigObjectModelFactory lcomf = new SecurityConfigObjectModelFactory();
- UsersObjectModelFactory uomf = new UsersObjectModelFactory();
- URL xmlFileURL = tcl.getResource(xmlFile);
- assertNotNull("XML File URL is not null", xmlFileURL);
- InputStreamReader xmlReader = loadURL(xmlFileURL);
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.mapFactoryToNamespace(uomf, "http://www.jboss.org/j2ee/schemas/XMLLoginModule");
- unmarshaller.setSchemaValidation(true);
- unmarshaller.setNamespaceAware(true);
- unmarshaller.setFeature(Unmarshaller.SCHEMA_VALIDATION, Boolean.TRUE);
- Object root = null;
- config = (PolicyConfig) unmarshaller.unmarshal(xmlReader, lcomf, root);
- assertNotNull("PolicyConfig is not null", config);
- }
-
- public void testValidateJAASConfiguration()
- {
- ApplicationPolicy jaasConfig = config.get("conf-jaas");
- BaseAuthenticationInfo authInfo = jaasConfig.getAuthenticationInfo();
- List<?> entries = authInfo.getModuleEntries();
- assertEquals("Number of entries = 2", 2, entries.size());
-
- // First Entry
- Object entry = entries.get(0);
- assertTrue("Entry instanceof AppConfigurationEntry", entry instanceof AppConfigurationEntry);
- AppConfigurationEntry ace = (AppConfigurationEntry) entry;
- assertEquals("LM Name", "org.jboss.test.TestLoginModule", ace.getLoginModuleName());
- assertEquals("Required", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, ace.getControlFlag());
- Map<String, ?> aceOptions = ace.getOptions();
- assertEquals("Number of options = 3", 3, aceOptions.size());
- assertEquals("name=1.1", "1.1", aceOptions.get("name"));
- assertEquals("succeed=true", "true", aceOptions.get("succeed"));
- assertEquals("throwEx=false", "false", aceOptions.get("throwEx"));
-
- // Second Entry
- entry = entries.get(1);
- assertTrue("Entry instanceof AppConfigurationEntry", entry instanceof AppConfigurationEntry);
- ace = (AppConfigurationEntry) entry;
- assertEquals("LM Name", "org.jboss.test.TestLoginModule2", ace.getLoginModuleName());
- assertEquals("Optional expected", AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL, ace.getControlFlag());
- aceOptions = ace.getOptions();
- assertEquals("Number of options = 4", 4, aceOptions.size());
- assertEquals("name=1.2", "1.2", aceOptions.get("name"));
- assertEquals("succeed=false", "false", aceOptions.get("succeed"));
- assertEquals("throwEx=true", "true", aceOptions.get("throwEx"));
- assertEquals("dummy=d", "d", aceOptions.get("dummy"));
-
- }
-
- public void testValidateJASPIConfiguration()
- {
- ApplicationPolicy jaspiConfig = config.get("conf-jaspi");
- BaseAuthenticationInfo authInfo = jaspiConfig.getAuthenticationInfo();
- List<?> entries = authInfo.getModuleEntries();
- assertEquals("Number of entries = 2", 2, entries.size());
-
- // First Entry
- Object entry = entries.get(0);
- assertTrue("Entry instanceof AppConfigurationEntry", entry instanceof AuthModuleEntry);
- AuthModuleEntry ace = (AuthModuleEntry) entry;
- assertEquals("LM Name", "TestAuthModule", ace.getAuthModuleName());
- assertEquals("Required", ControlFlag.REQUIRED, ace.getControlFlag());
- Map<String, ?> aceOptions = ace.getOptions();
- assertEquals("Number of options = 3", 3, aceOptions.size());
- assertEquals("usersProperties=u", "u", aceOptions.get("usersProperties"));
- assertEquals("rolesProperties=r", "r", aceOptions.get("rolesProperties"));
- assertEquals("unauthenticatedIdentity=anonymous", "anonymous", aceOptions.get("unauthenticatedIdentity"));
-
- // Second Entry
- entry = entries.get(1);
- assertTrue("Entry instanceof AppConfigurationEntry", entry instanceof AuthModuleEntry);
- ace = (AuthModuleEntry) entry;
- assertEquals("LM Name", "TestAuthModule2", ace.getAuthModuleName());
- assertEquals("Required", ControlFlag.REQUIRED, ace.getControlFlag());
- aceOptions = ace.getOptions();
- assertEquals("Number of options = 0", 0, aceOptions.size());
- LoginModuleStackHolder lmsh = ace.getLoginModuleStackHolder();
- assertEquals("lm-stack", "lm-stack", lmsh.getName());
- AppConfigurationEntry[] appEntries = lmsh.getAppConfigurationEntry();
- assertEquals("App Entries in LMSH=1", 1, appEntries.length);
-
- Object appEntry = appEntries[0];
- assertTrue("Entry instanceof AppConfigurationEntry", appEntry instanceof AppConfigurationEntry);
- AppConfigurationEntry appace = (AppConfigurationEntry) appEntry;
- assertEquals("LM Name", "org.jboss.security.auth.spi.UsersRolesLoginModule", appace.getLoginModuleName());
- assertEquals("Optional", AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL, appace.getControlFlag());
- Map<String, ?> appaceOptions = appace.getOptions();
- assertEquals("Number of options = 3", 3, appaceOptions.size());
- assertEquals("usersProperties=u", "u", appaceOptions.get("usersProperties"));
- assertEquals("rolesProperties=r", "r", appaceOptions.get("rolesProperties"));
- assertEquals("unauthenticatedIdentity=anonymous", "anonymous", appaceOptions.get("unauthenticatedIdentity"));
- }
-
- public void testValidateCompleteConfiguration()
- {
- ApplicationPolicy completeConfig = config.get("conf-complete");
- BaseAuthenticationInfo authInfo = completeConfig.getAuthenticationInfo();
- List<?> entries = authInfo.getModuleEntries();
- assertEquals("Number of entries = 1", 1, entries.size());
-
- // First Entry
- Object entry = entries.get(0);
- assertTrue("Entry instanceof AppConfigurationEntry", entry instanceof AppConfigurationEntry);
- AppConfigurationEntry ace = (AppConfigurationEntry) entry;
- assertEquals("LM Name", "org.jboss.test.TestLoginModule", ace.getLoginModuleName());
- assertEquals("Required", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, ace.getControlFlag());
- Map<String, ?> aceOptions = ace.getOptions();
- assertEquals("Number of options = 3", 3, aceOptions.size());
- assertEquals("name=1.1", "1.1", aceOptions.get("name"));
- assertEquals("succeed=true", "true", aceOptions.get("succeed"));
- assertEquals("throwEx=false", "false", aceOptions.get("throwEx"));
-
- // Authorization
- AuthorizationInfo authzInfo = completeConfig.getAuthorizationInfo();
- assertNotNull("AuthorizationInfo is not null", authzInfo);
- AuthorizationModuleEntry[] authzEntries = authzInfo.getAuthorizationModuleEntry();
- assertEquals("Length of authorization entries = 1", 1, authzEntries.length);
- AuthorizationModuleEntry authzEntry = authzEntries[0];
- assertEquals("TestPolicyModule", "org.jboss.test.TestPolicyModule", authzEntry.getPolicyModuleName());
- assertEquals("Required", ControlFlag.REQUIRED, authzEntry.getControlFlag());
- Map<String, ?> authzoptions = authzEntry.getOptions();
- assertEquals("Number of options = 2", 2, authzoptions.size());
- assertEquals("name=authz", "authz", authzoptions.get("name"));
- assertEquals("succeed=true", "true", authzoptions.get("succeed"));
-
- // ACL (instance-based authorization)
- ACLInfo aclInfo = completeConfig.getAclInfo();
- assertNotNull("Unexpected null ACLInfo found", aclInfo);
- ACLProviderEntry[] aclEntries = aclInfo.getACLProviderEntry();
- assertNotNull("Unexpected null set of acl entries", aclEntries);
- assertEquals("Invalid number of acl entries", 2, aclEntries.length);
- // first entry should be org.jboss.security.authz.ACLModule1.
- Assert.assertEquals("org.jboss.security.authz.ACLModule1", aclEntries[0].getAclProviderName());
- Assert.assertEquals("REQUIRED", aclEntries[0].getControlFlag().toString());
- Map<String, ?> options = aclEntries[0].getOptions();
- Assert.assertNotNull("Unexpected null options map", options);
- Assert.assertTrue("Option aclOption1 was not found", options.containsKey("aclOption1"));
- Assert.assertEquals("value1", options.get("aclOption1"));
- Assert.assertTrue("Option aclOption2 was not found", options.containsKey("aclOption2"));
- Assert.assertEquals("value2", options.get("aclOption2"));
- // second entry should be the org.jboss.security.authz.ACLModule2.
- Assert.assertEquals("org.jboss.security.authz.ACLModule2", aclEntries[1].getAclProviderName());
- Assert.assertEquals("REQUIRED", aclEntries[1].getControlFlag().toString());
- options = aclEntries[1].getOptions();
- Assert.assertNotNull("Unexpected null options map", options);
- Assert.assertTrue("Option aclOption3 was not found", options.containsKey("aclOption3"));
- Assert.assertEquals("value3", options.get("aclOption3"));
- Assert.assertTrue("Option aclOption4 was not found", options.containsKey("aclOption4"));
- Assert.assertEquals("value4", options.get("aclOption4"));
-
- // Mapping
- MappingInfo mappingInfo = completeConfig.getMappingInfo(MappingType.PRINCIPAL.toString());
- assertNotNull("MappingInfo is not null", mappingInfo);
- MappingModuleEntry[] mappingEntries = mappingInfo.getMappingModuleEntry();
- assertEquals("Invalid number of entries", 1, mappingEntries.length);
- MappingModuleEntry mappingEntry = mappingEntries[0];
- assertEquals("org.jboss.test.mapping.MappingModule1", mappingEntry.getMappingModuleName());
- Map<String, ?> mappingOptions = mappingEntry.getOptions();
- assertEquals("Invalid number of options", 1, mappingOptions.size());
- Assert.assertTrue("Option option1 was not found", mappingOptions.containsKey("option1"));
- assertEquals("value1", mappingOptions.get("option1"));
-
- // Role Mapping
- mappingInfo = completeConfig.getMappingInfo(MappingType.ROLE.toString());
- assertNotNull("MappingInfo is not null", mappingInfo);
- MappingModuleEntry[] mmearr = mappingInfo.getMappingModuleEntry();
- assertEquals("Mapping entry length=1", 1, mmearr.length);
- MappingModuleEntry mme = mmearr[0];
- assertEquals("TestMappingModule", "org.jboss.test.TestMappingModule", mme.getMappingModuleName());
- Map<String, ?> mmOptions = mme.getOptions();
- assertEquals("Number of options = 2", 2, mmOptions.size());
- assertEquals("name=rolemap", "rolemap", mmOptions.get("name"));
- assertEquals("succeed=true", "true", mmOptions.get("succeed"));
-
- // Audit
- AuditInfo ai = completeConfig.getAuditInfo();
- assertNotNull("AuditInfo", ai);
- AuditProviderEntry[] apelist = ai.getAuditProviderEntry();
- assertEquals("Audit entry length=1", 1, apelist.length);
- AuditProviderEntry ape = apelist[0];
- assertEquals("TestMappingModule", "org.jboss.test.TestMappingModule", mme.getMappingModuleName());
- Map<String, ?> auditOptions = ape.getOptions();
- assertEquals("Number of options = 2", 2, auditOptions.size());
- assertEquals("name=auditprovider", "auditprovider", auditOptions.get("name"));
- assertEquals("succeed=false", "false", auditOptions.get("succeed"));
-
- // Identity Trust
- IdentityTrustInfo iti = completeConfig.getIdentityTrustInfo();
- assertNotNull("IdentityTrustInfo", iti);
- IdentityTrustModuleEntry[] itilist = iti.getIdentityTrustModuleEntry();
- assertEquals("IdentityTrustModuleEntry length=1", 1, itilist.length);
- IdentityTrustModuleEntry itie = itilist[0];
- assertEquals("TestMappingModule", "org.jboss.test.TestMappingModule", mme.getMappingModuleName());
- Map<String, ?> itieOptions = itie.getOptions();
- assertEquals("Number of options = 3", 3, itieOptions.size());
- assertEquals("name=trustprovider", "trustprovider", itieOptions.get("name"));
- assertEquals("succeed=true", "true", itieOptions.get("succeed"));
- assertEquals("dummy=dr", "dr", itieOptions.get("dummy"));
- }
-
- public void testApplicationPolicyExtension()
- {
- ApplicationPolicy completeConfig = config.get("conf-jaas-extend");
- assertNotNull("conf-jaas-extend is not null", completeConfig);
- BaseAuthenticationInfo bai = completeConfig.getAuthenticationInfo();
- assertNotNull("BaseAuthenticationInfo is not null", bai);
- assertEquals("3 login modules", 3, bai.getModuleEntries().size());
-
- // Authorization
- AuthorizationInfo azi = completeConfig.getAuthorizationInfo();
- assertNotNull("AuthorizationInfo is not null", azi);
- assertEquals("3 authz modules", 3, azi.getModuleEntries().size());
-
- // ACL
- ACLInfo aclInfo = completeConfig.getAclInfo();
- assertNotNull("Unexpected null ACLInfo", aclInfo);
- assertEquals("Unexpected number of acl modules", 3, aclInfo.getModuleEntries().size());
-
- // Role Mapping
- MappingInfo mappingInfo = completeConfig.getMappingInfo(MappingType.ROLE.toString());
- assertNotNull("MappingInfo is not null", mappingInfo);
- // we expect 2 modules because one has been configured as a mapping of type "role"
- assertEquals("2 map modules", 2, mappingInfo.getModuleEntries().size());
-
- // Mapping
- mappingInfo = completeConfig.getMappingInfo(MappingType.PRINCIPAL.toString());
- assertNotNull("MappingInfo is not null", mappingInfo);
- MappingModuleEntry[] mappingEntries = mappingInfo.getMappingModuleEntry();
- assertEquals("Invalid number of entries", 2, mappingEntries.length);
- assertEquals("org.jboss.test.mapping.MappingModule1", mappingEntries[0].getMappingModuleName());
- assertEquals("org.jboss.test.mapping.MappingModule3", mappingEntries[1].getMappingModuleName());
- // same test as above: we expect 2 role-mapping modules: 1 from rolemapping and 1 from mapping with type "role".
- mappingInfo = completeConfig.getMappingInfo(MappingType.ROLE.toString());
- assertNotNull("MappingInfo is not null", mappingInfo);
- mappingEntries = mappingInfo.getMappingModuleEntry();
- assertEquals("Invalid number of entries", 2, mappingEntries.length);
- assertEquals("org.jboss.test.TestMappingModule", mappingEntries[0].getMappingModuleName());
- assertEquals("org.jboss.test.mapping.MappingModule2", mappingEntries[1].getMappingModuleName());
-
- // Audit
- AuditInfo ai = completeConfig.getAuditInfo();
- assertNotNull("AuditInfo", ai);
- AuditProviderEntry[] apelist = ai.getAuditProviderEntry();
- assertEquals("Audit entry length=1", 1, apelist.length);
-
- // Identity Trust
- IdentityTrustInfo iti = completeConfig.getIdentityTrustInfo();
- assertNotNull("IdentityTrustInfo", iti);
- IdentityTrustModuleEntry[] itilist = iti.getIdentityTrustModuleEntry();
- assertEquals("IdentityTrustModuleEntry length=1", 1, itilist.length);
-
- // JASPI authentication policy extension
- ApplicationPolicy jaspiPolicy = config.get("conf-jaspi-extend");
- assertNotNull("Unexpected null conf-jaspi-extend application policy", jaspiPolicy);
- BaseAuthenticationInfo authInfo = jaspiPolicy.getAuthenticationInfo();
- assertNotNull("Unexpected null jaspi configuration", authInfo);
- List<?> entries = authInfo.getModuleEntries();
- assertEquals("Invalid number of auth modules", 3, entries.size());
- }
-
- public void testAddDeletionOfApplicationPolicies()
- {
- ApplicationPolicy aPolicy = new ApplicationPolicy("test");
- SecurityConfiguration.addApplicationPolicy(aPolicy);
- ApplicationPolicy ap = SecurityConfiguration.getApplicationPolicy("test");
- assertNotNull("Application Policy for test != null", ap);
- assertEquals("Application Policy Name = test", "test", ap.getName());
-
- SecurityConfiguration.removeApplicationPolicy("test");
- assertNull("Application Policy for test is null", SecurityConfiguration.getApplicationPolicy("test"));
- }
-
- private InputStreamReader loadURL(URL configURL) throws IOException
- {
- InputStream is = configURL.openStream();
- if (is == null)
- throw new IOException("Failed to obtain InputStream from url: " + configURL);
- InputStreamReader xmlReader = new InputStreamReader(is);
- return xmlReader;
- }
-}
\ No newline at end of file
Deleted: trunk/security-jboss-sx/jbosssx/src/test/resources/config/jboss-acl.xml
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/test/resources/config/jboss-acl.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx/src/test/resources/config/jboss-acl.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,30 +0,0 @@
-<jboss-acl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:jboss-acl-config:1.0"
- xmlns="urn:jboss:jboss-acl-config:1.0"
- xmlns:jbxb="urn:jboss:jboss-acl-config:1.0">
-
- <acl-definition resource="org.jboss.test.authorization.acl.ACLTestResource:10">
- <entry>
- <identity-name>Administrator</identity-name>
- <permissions>CREATE,READ,UPDATE,DELETE</permissions>
- </entry>
- <entry>
- <identity-name>Guest</identity-name>
- <permissions>READ</permissions>
- </entry>
- </acl-definition>
-
- <!-- An extends attribute allows an ACL to inherit all the entries from its parent ACL -->
- <acl-definition resource="org.jboss.test.authorization.acl.ACLTestResource:20" extends="org.jboss.test.authorization.acl.ACLTestResource:10">
- <entry>
- <identity-name>Regular_User</identity-name>
- <permissions>READ,UPDATE</permissions>
- </entry>
- <!-- This overrides the definition from the parent ACL -->
- <entry>
- <identity-name>Guest</identity-name>
- <permissions>READ,UPDATE</permissions>
- </entry>
- </acl-definition>
-
-</jboss-acl>
\ No newline at end of file
Modified: trunk/security-jboss-sx/jbosssx-client/pom.xml
===================================================================
--- trunk/security-jboss-sx/jbosssx-client/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/jbosssx-client/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketbox</groupId>
<artifactId>jbosssx-client</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PicketBox Client</name>
<url>http://www.jboss.org/picketbox</url>
Modified: trunk/security-jboss-sx/parent/pom.xml
===================================================================
--- trunk/security-jboss-sx/parent/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/parent/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -8,7 +8,7 @@
<groupId>org.picketbox</groupId>
<artifactId>jbosssx-parent</artifactId>
<packaging>pom</packaging>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<name>JBossSX - Parent</name>
<url>http://jboss.org/picketbox</url>
<description>PicketBox is a security project for Java Applications.</description>
@@ -23,8 +23,8 @@
<url>http://www.jboss.org</url>
</organization>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-jboss-sx/tags/3.0.0.CR2-SNAPSHOT</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-jboss-sx/tags/3.0.0.CR2-SNAPSHOT</developerConnection>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-jboss-sx/tags/4.0.0-SNAPSHOT</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-jboss-sx/tags/4.0.0-SNAPSHOT</developerConnection>
</scm>
<build>
@@ -87,18 +87,18 @@
<dependencyManagement>
<dependencies>
<dependency>
+ <groupId>oswego-concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <version>1.3.4-jboss</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
<version>2.1.1.GA</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <version>2.0.1.GA</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-jacc-api</artifactId>
<version>1.1.0.${org.jboss.javaee.version}</version>
@@ -127,6 +127,6 @@
<properties>
<org.jboss.javaee.version>GA</org.jboss.javaee.version>
- <org.jboss.security.spi.version>3.0.0.CR2-SNAPSHOT</org.jboss.security.spi.version>
+ <org.jboss.security.spi.version>4.0.0-SNAPSHOT</org.jboss.security.spi.version>
</properties>
</project>
Modified: trunk/security-jboss-sx/pom.xml
===================================================================
--- trunk/security-jboss-sx/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-jboss-sx/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketbox</groupId>
<artifactId>jbosssx-pom</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>PicketBox Implementation - Parent</name>
<url>http://jboss.org/picketbox</url>
@@ -53,7 +53,6 @@
<module>acl</module>
<module>jbosssx</module>
<module>jbosssx-client</module>
- <module>jbosssx-mc-int</module>
<module>assembly</module>
</modules>
Modified: trunk/security-spi/acl/pom.xml
===================================================================
--- trunk/security-spi/acl/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/acl/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>picketbox-spi-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -22,9 +22,9 @@
<url>http://www.jboss.org</url>
</organization>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</developerConnection>
- <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/picketbox/security-spi/tags/4.0.0-SNAPSHOT</url>
</scm>
<dependencies>
<dependency>
Deleted: trunk/security-spi/acl/src/main/java/org/jboss/security/acl/ACLContext.java
===================================================================
--- trunk/security-spi/acl/src/main/java/org/jboss/security/acl/ACLContext.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/acl/src/main/java/org/jboss/security/acl/ACLContext.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -1,92 +0,0 @@
-/*
- * 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.acl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.security.authorization.AuthorizationException;
-import org.jboss.security.authorization.EntitlementHolder;
-import org.jboss.security.authorization.Permission;
-import org.jboss.security.authorization.Resource;
-import org.jboss.security.config.ControlFlag;
-import org.jboss.security.identity.Identity;
-
-/**
- * Represents a set of ACLProviders
- *
- * @author Anil.Saldhana at redhat.com
- * @since Jan 30, 2008
- * @version $Revision$
- */
-public abstract class ACLContext
-{
- protected String securityDomainName = null;
-
- protected Map<String, Object> sharedState = new HashMap<String, Object>();
-
- protected List<ACLProvider> modules = new ArrayList<ACLProvider>();
-
- /**
- * Control Flags for the individual modules
- */
- protected List<ControlFlag> controlFlags = new ArrayList<ControlFlag>();
-
- /**
- * Instance Based Security Get all the entitlements assigned to the components of a Resource
- *
- * @param clazz class type of the entitlements
- * @param resource A Resource (Can be a Portal Resource, a Rules Resource)
- * @param identity The Identity against whom the entitlements need to be generated
- * @return a Entitlements Wrapper
- * @throws AuthorizationException
- */
- public abstract <T> EntitlementHolder<T> getEntitlements(final Class<T> clazz, final Resource resource,
- final Identity identity) throws AuthorizationException;
-
- /**
- * <p>
- * Authorize access to the resource if the specified identity has the proper permissions.
- * </p>
- *
- * @param resource the {@code Resource} being accessed.
- * @param identity the {@code Identity} trying to access the resource.
- * @param permission the permissions required for access to be granted.
- * @return {@code AuthorizationContext#PERMIT} if access has been granted; {@code AuthorizationContext#DENY}
- * otherwise.
- * @throws AuthorizationException if an error occurs while authorizing access to the resource.
- */
- public abstract int authorize(Resource resource, Identity identity, Permission permission)
- throws AuthorizationException;
-
- /**
- * Return the Security Domain Name
- *
- * @return security domain
- */
- public String getSecurityDomain()
- {
- return this.securityDomainName;
- }
-}
\ No newline at end of file
Modified: trunk/security-spi/assembly/pom.xml
===================================================================
--- trunk/security-spi/assembly/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/assembly/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>picketbox-spi-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/security-spi/authorization/pom.xml
===================================================================
--- trunk/security-spi/authorization/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/authorization/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>picketbox-spi-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -22,9 +22,9 @@
<url>http://www.jboss.org</url>
</organization>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</developerConnection>
- <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/picketbox/security-spi/tags/4.0.0-SNAPSHOT</url>
</scm>
<dependencies>
<dependency>
Modified: trunk/security-spi/authorization/src/main/java/org/jboss/security/AuthorizationManager.java
===================================================================
--- trunk/security-spi/authorization/src/main/java/org/jboss/security/AuthorizationManager.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/authorization/src/main/java/org/jboss/security/AuthorizationManager.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -30,10 +30,7 @@
import javax.security.auth.callback.CallbackHandler;
import org.jboss.security.authorization.AuthorizationException;
-import org.jboss.security.authorization.EntitlementHolder;
-import org.jboss.security.authorization.Permission;
import org.jboss.security.authorization.Resource;
-import org.jboss.security.identity.Identity;
import org.jboss.security.identity.RoleGroup;
// $Id$
@@ -90,33 +87,6 @@
public int authorize(final Resource resource, Subject subject, Group roleGroup) throws AuthorizationException;
/**
- * <p>
- * Authorize access to the resource if the specified identity has the proper permissions.
- * </p>
- *
- * @param resource the {@code Resource} being accessed.
- * @param identity the {@code Identity} trying to access the resource.
- * @param permission the permissions required for access to be granted.
- * @return {@code AuthorizationContext#PERMIT} if access has been granted; {@code AuthorizationContext#DENY}
- * otherwise.
- * @throws AuthorizationException if an error occurs while authorizing access to the resource.
- */
- public int authorize(final Resource resource, Identity identity, Permission permission)
- throws AuthorizationException;
-
- /**
- * Instance Based Security Get all the entitlements assigned to the components of a Resource
- *
- * @param clazz Defines the class type of the entitlements
- * @param resource A Resource (Can be a Portal Resource, a Rules Resource)
- * @param identity The Identity against whom the entitlements need to be generated
- * @return a Entitlements Wrapper
- * @throws AuthorizationException
- */
- public <T> EntitlementHolder<T> getEntitlements(final Class<T> clazz, final Resource resource,
- final Identity identity) throws AuthorizationException;
-
- /**
* Validates the application domain roles to which the operational environment Principal belongs.
*
* @param principal the caller principal as known in the operation environment.
Modified: trunk/security-spi/authorization/src/main/java/org/jboss/security/authorization/PolicyRegistration.java
===================================================================
--- trunk/security-spi/authorization/src/main/java/org/jboss/security/authorization/PolicyRegistration.java 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/authorization/src/main/java/org/jboss/security/authorization/PolicyRegistration.java 2010-09-28 20:57:54 UTC (rev 128)
@@ -46,11 +46,6 @@
String JACC = "JACC";
/**
- * Represents a ACL policy
- */
- String ACL = "ACL";
-
- /**
* Represents a Custom policy
*/
String CUSTOM = "CUSTOM";
Modified: trunk/security-spi/identity/pom.xml
===================================================================
--- trunk/security-spi/identity/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/identity/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>picketbox-spi-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -22,9 +22,9 @@
<url>http://www.jboss.org</url>
</organization>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</developerConnection>
- <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/picketbox/security-spi/tags/4.0.0-SNAPSHOT</url>
</scm>
<reporting>
<plugins>
Modified: trunk/security-spi/parent/pom.xml
===================================================================
--- trunk/security-spi/parent/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/parent/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -8,7 +8,7 @@
<groupId>org.picketbox</groupId>
<artifactId>picketbox-spi-parent</artifactId>
<packaging>pom</packaging>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<name>PicketBox SPI - Parent</name>
<url>http://jboss.org/picketbox</url>
<description>PicketBox is a security project for Java Applications.</description>
@@ -23,8 +23,8 @@
<url>http://www.jboss.org</url>
</organization>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</developerConnection>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</developerConnection>
</scm>
<build>
Modified: trunk/security-spi/pom.xml
===================================================================
--- trunk/security-spi/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>picketbox-spi-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/security-spi/spi/pom.xml
===================================================================
--- trunk/security-spi/spi/pom.xml 2010-09-28 16:53:09 UTC (rev 127)
+++ trunk/security-spi/spi/pom.xml 2010-09-28 20:57:54 UTC (rev 128)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketbox</groupId>
<artifactId>picketbox-spi-parent</artifactId>
- <version>3.0.0.CR2-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -22,9 +22,9 @@
<url>http://www.jboss.org</url>
</organization>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</developerConnection>
- <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/picketbox/security-spi/tags/3.0.0.CR2-SNAPSHOT</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/picketbox/security-spi/tags/4.0.0-SNAPSHOT</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/picketbox/security-spi/tags/4.0.0-SNAPSHOT</url>
</scm>
<build>
<resources>
More information about the jboss-cvs-commits
mailing list