[jboss-cvs] JBossAS SVN: r92179 - in projects/security/security-jboss-sx/tags: 2.0.4 and 20 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 10 00:26:45 EDT 2009
Author: anil.saldhana at jboss.com
Date: 2009-08-10 00:26:43 -0400 (Mon, 10 Aug 2009)
New Revision: 92179
Added:
projects/security/security-jboss-sx/tags/2.0.4/
projects/security/security-jboss-sx/tags/2.0.4/acl/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/assembly/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/identity/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx-bridge-as4/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx-client/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/src/test/java/org/jboss/test/security/microcontainer/metadata/support/MockMappingManager.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/SimpleServerLoginModule.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/AttributeMappingInfo.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/ClientLoginModuleUnitTestCase.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/LdapLoginModuleDecodeActionUnitTestCase.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestCase.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestsAdapter.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/mapping/LdapAttributeMappingProviderUnitTestCase.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/MappingContextTestCase.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/SecurityContextBaseTest.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/resources/ldap/ldapAttributes.ldif
projects/security/security-jboss-sx/tags/2.0.4/parent/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/pom.xml
Removed:
projects/security/security-jboss-sx/tags/2.0.4/acl/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/assembly/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/identity/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx-bridge-as4/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx-client/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/src/test/java/org/jboss/test/security/microcontainer/metadata/support/MockMappingManager.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/SimpleServerLoginModule.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/ClientLoginModuleUnitTestCase.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestCase.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/MappingContextTestCase.java
projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/SecurityContextBaseTest.java
projects/security/security-jboss-sx/tags/2.0.4/parent/pom.xml
projects/security/security-jboss-sx/tags/2.0.4/pom.xml
Log:
[maven-release-plugin] copy for tag 2.0.4
Copied: projects/security/security-jboss-sx/tags/2.0.4 (from rev 91524, projects/security/security-jboss-sx/branches/Branch_2_0)
Deleted: projects/security/security-jboss-sx/tags/2.0.4/acl/pom.xml
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/acl/pom.xml 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/acl/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,122 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-parent</artifactId>
- <version>2.0.3.SP2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jboss-security-acl-impl</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Security ACL Implementation</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss Inc.</name>
- <url>http://www.jboss.org</url>
- </organization>
- <profiles>
- <!-- mvn install -Psecurity-manager -->
- <profile>
- <id>security-manager</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
- <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
- <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} ${test.env}</surefire.jvm.args>
- </properties>
- </profile>
- <!-- mvn install -Psecurity-manager-debug -->
- <!-- Best Practice: mvn install -Psecurity-manager-debug 2>&1 > logfile2>&1 > logfile -->
- <profile>
- <id>security-manager-debug</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
- <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
- <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} -Djava.security.debug=failure,access ${test.env}</surefire.jvm.args>
- </properties>
- </profile>
- </profiles>
- <build>
- <sourceDirectory>src/main/java</sourceDirectory>
- <outputDirectory>target/classes</outputDirectory>
- <testSourceDirectory>src/tests/java</testSourceDirectory>
- <testOutputDirectory>target/test-classes</testOutputDirectory>
- <finalName>${artifactId}</finalName>
- <resources>
- <resource>
- <directory>${basedir}</directory>
- <includes>
- <include>JBossORG-EULA.txt</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <includes>
- <include>**/*.dtd</include>
- <include>**/*.xsd</include>
- </includes>
- </resource>
- </resources>
- <testResources>
- <testResource>
- <directory>src/tests/resources/</directory>
- <includes>
- <include>**/*.xml</include>
- </includes>
- </testResource>
- </testResources>
- </build>
- <dependencies>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <version>3.2.4.sp1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>3.3.0.ga</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <version>3.3.1.ga</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.8.0.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>identity-impl</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
Copied: projects/security/security-jboss-sx/tags/2.0.4/acl/pom.xml (from rev 92178, projects/security/security-jboss-sx/branches/Branch_2_0/acl/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/acl/pom.xml (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/acl/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,122 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-parent</artifactId>
+ <version>2.0.4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-security-acl-impl</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Security ACL Implementation</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <profiles>
+ <!-- mvn install -Psecurity-manager -->
+ <profile>
+ <id>security-manager</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
+ <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
+ <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} ${test.env}</surefire.jvm.args>
+ </properties>
+ </profile>
+ <!-- mvn install -Psecurity-manager-debug -->
+ <!-- Best Practice: mvn install -Psecurity-manager-debug 2>&1 > logfile2>&1 > logfile -->
+ <profile>
+ <id>security-manager-debug</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
+ <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
+ <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} -Djava.security.debug=failure,access ${test.env}</surefire.jvm.args>
+ </properties>
+ </profile>
+ </profiles>
+ <build>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <outputDirectory>target/classes</outputDirectory>
+ <testSourceDirectory>src/tests/java</testSourceDirectory>
+ <testOutputDirectory>target/test-classes</testOutputDirectory>
+ <finalName>${artifactId}</finalName>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>JBossORG-EULA.txt</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.dtd</include>
+ <include>**/*.xsd</include>
+ </includes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/tests/resources/</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </testResource>
+ </testResources>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <version>3.2.4.sp1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.3.0.ga</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.3.1.ga</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>identity-impl</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+</project>
Deleted: projects/security/security-jboss-sx/tags/2.0.4/assembly/pom.xml
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/assembly/pom.xml 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/assembly/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,62 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-parent</artifactId>
- <version>2.0.3.SP2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx</artifactId>
- <packaging>pom</packaging>
- <name>JBoss Security Implementation for the JBAS - Assembly</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss Inc.</name>
- <url>http://www.jboss.org</url>
- </organization>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.1</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <archive>
- <manifestEntries>
- <Specification-Title>JBoss Security Implementation for the JBAS</Specification-Title>
- <Specification-Version>${project.version}</Specification-Version>
- <Specification-Vendor>Red Hat Middleware LLC</Specification-Vendor>
- <Implementation-Title>JBoss Security Implementation for the JBAS</Implementation-Title>
- <Implementation-Version>${project.version}</Implementation-Version>
- <Implementation-VendorId>org.jboss.security</Implementation-VendorId>
- <Implementation-Vendor>Red Hat Middleware LLC</Implementation-Vendor>
- <Implementation-URL>http://labs.jboss.org/portal/jbosssecurity/</Implementation-URL>
- </manifestEntries>
- </archive>
- <descriptors>
- <descriptor>src/assembly/bin.xml</descriptor>
- <descriptor>src/assembly/sources.xml</descriptor>
- </descriptors>
- </configuration>
- <inherited>false</inherited>
- </plugin>
- </plugins>
- </build>
-
-</project>
Copied: projects/security/security-jboss-sx/tags/2.0.4/assembly/pom.xml (from rev 92178, projects/security/security-jboss-sx/branches/Branch_2_0/assembly/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/assembly/pom.xml (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/assembly/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,62 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-parent</artifactId>
+ <version>2.0.4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Security Implementation for the JBAS - Assembly</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.1</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Specification-Title>JBoss Security Implementation for the JBAS</Specification-Title>
+ <Specification-Version>${project.version}</Specification-Version>
+ <Specification-Vendor>Red Hat Middleware LLC</Specification-Vendor>
+ <Implementation-Title>JBoss Security Implementation for the JBAS</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <Implementation-VendorId>org.jboss.security</Implementation-VendorId>
+ <Implementation-Vendor>Red Hat Middleware LLC</Implementation-Vendor>
+ <Implementation-URL>http://labs.jboss.org/portal/jbosssecurity/</Implementation-URL>
+ </manifestEntries>
+ </archive>
+ <descriptors>
+ <descriptor>src/assembly/bin.xml</descriptor>
+ <descriptor>src/assembly/sources.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <inherited>false</inherited>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Deleted: projects/security/security-jboss-sx/tags/2.0.4/identity/pom.xml
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/identity/pom.xml 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/identity/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,86 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-parent</artifactId>
- <version>2.0.3.SP2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>identity-impl</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Security Identity Implementation</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss Inc.</name>
- <url>http://www.jboss.org</url>
- </organization>
- <profiles>
- <!-- mvn install -Psecurity-manager -->
- <profile>
- <id>security-manager</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
- <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
- <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} ${test.env}</surefire.jvm.args>
- </properties>
- </profile>
- <!-- mvn install -Psecurity-manager-debug -->
- <!-- Best Practice: mvn install -Psecurity-manager-debug 2>&1 > logfile2>&1 > logfile -->
- <profile>
- <id>security-manager-debug</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
- <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
- <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} -Djava.security.debug=failure,access ${test.env}</surefire.jvm.args>
- </properties>
- </profile>
- </profiles>
- <build>
- <finalName>${artifactId}</finalName>
- <resources>
- <resource>
- <directory>src/main</directory>
- <includes>
- <include>**/*.xml</include>
- </includes>
- </resource>
- <resource>
- <directory>${basedir}</directory>
- <includes>
- <include>JBossORG-EULA.txt</include>
- </includes>
- </resource>
- <resource>
- <directory>src/resources</directory>
- <includes>
- <include>**/*.dtd</include>
- <include>**/*.xsd</include>
- </includes>
- </resource>
- </resources>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jboss-security-spi</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
Copied: projects/security/security-jboss-sx/tags/2.0.4/identity/pom.xml (from rev 92178, projects/security/security-jboss-sx/branches/Branch_2_0/identity/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/identity/pom.xml (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/identity/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,86 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-parent</artifactId>
+ <version>2.0.4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>identity-impl</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Security Identity Implementation</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <profiles>
+ <!-- mvn install -Psecurity-manager -->
+ <profile>
+ <id>security-manager</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
+ <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
+ <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} ${test.env}</surefire.jvm.args>
+ </properties>
+ </profile>
+ <!-- mvn install -Psecurity-manager-debug -->
+ <!-- Best Practice: mvn install -Psecurity-manager-debug 2>&1 > logfile2>&1 > logfile -->
+ <profile>
+ <id>security-manager-debug</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
+ <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
+ <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} -Djava.security.debug=failure,access ${test.env}</surefire.jvm.args>
+ </properties>
+ </profile>
+ </profiles>
+ <build>
+ <finalName>${artifactId}</finalName>
+ <resources>
+ <resource>
+ <directory>src/main</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>JBossORG-EULA.txt</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/resources</directory>
+ <includes>
+ <include>**/*.dtd</include>
+ <include>**/*.xsd</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-security-spi</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/pom.xml
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/pom.xml 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,187 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-parent</artifactId>
- <version>2.0.3.SP2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jbosssx-bare</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Security Implementation for the JBAS</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss Inc.</name>
- <url>http://www.jboss.org</url>
- </organization>
- <profiles>
- <!-- mvn install -Psecurity-manager -->
- <profile>
- <id>security-manager</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
- <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
- <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} ${test.env}</surefire.jvm.args>
- </properties>
- </profile>
- <!-- mvn install -Psecurity-manager-debug -->
- <!-- Best Practice: mvn install -Psecurity-manager-debug 2>&1 > logfile2>&1 > logfile -->
- <profile>
- <id>security-manager-debug</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
- <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
- <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} -Djava.security.debug=policy,failure,access ${test.env}</surefire.jvm.args>
- </properties>
- </profile>
- <profile>
- <id>one-test</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <properties>
- <surefire.jvm.args>-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8686</surefire.jvm.args>
- </properties>
- </profile>
- </profiles>
-
- <build>
- <finalName>${artifactId}</finalName>
- <resources>
- <resource>
- <directory>src/main/java</directory>
- <includes>
- <include>**/*.xml</include>
- </includes>
- </resource>
- <resource>
- <directory>${basedir}</directory>
- <includes>
- <include>JBossORG-EULA.txt</include>
- </includes>
- </resource>
- <resource>
- <directory>src/resources</directory>
- <includes>
- <include>**/*.dtd</include>
- <include>**/*.xsd</include>
- </includes>
- </resource>
- <resource>
- <directory>target/generated-sources/javacc</directory>
- <includes>
- <include>**/*.class</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <!-- generate java files from grammar -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>javacc-maven-plugin</artifactId>
- <version>2.3-jboss-1</version>
- <configuration>
- <packageName>org/jboss/security/auth/login</packageName>
- <sourceDirectory>src/main/java</sourceDirectory>
- <isStatic>false</isStatic>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>javacc</goal>
- </goals>
- <id>javacc</id>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-jaspi-api</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jboss-security-acl-impl</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-javaee</artifactId>
- <version>5.0.0.GA</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>sun-jaxb</groupId>
- <artifactId>jaxb-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-jmx</artifactId>
- <version>4.2.1.GA</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbossxacml</artifactId>
- <version>2.0.3.CR2</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>sun-jaxb</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.9</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jnpserver</artifactId>
- <version>4.2.3.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>sun-opends</groupId>
- <artifactId>OpenDS</artifactId>
- <version>1.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>sleepycat</groupId>
- <artifactId>je</artifactId>
- <version>3.2.43</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/pom.xml (from rev 92178, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/pom.xml (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,187 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-parent</artifactId>
+ <version>2.0.4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbosssx-bare</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Security Implementation for the JBAS</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <profiles>
+ <!-- mvn install -Psecurity-manager -->
+ <profile>
+ <id>security-manager</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
+ <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
+ <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} ${test.env}</surefire.jvm.args>
+ </properties>
+ </profile>
+ <!-- mvn install -Psecurity-manager-debug -->
+ <!-- Best Practice: mvn install -Psecurity-manager-debug 2>&1 > logfile2>&1 > logfile -->
+ <profile>
+ <id>security-manager-debug</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <test.env>-Dtest.basedir=${basedir}/target/test-classes</test.env>
+ <policy.file>${basedir}/src/tests/resources/java.policy</policy.file>
+ <surefire.jvm.args>-Djava.security.manager -Djava.security.policy=${policy.file} -Djava.security.debug=policy,failure,access ${test.env}</surefire.jvm.args>
+ </properties>
+ </profile>
+ <profile>
+ <id>one-test</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <surefire.jvm.args>-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8686</surefire.jvm.args>
+ </properties>
+ </profile>
+ </profiles>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>JBossORG-EULA.txt</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/resources</directory>
+ <includes>
+ <include>**/*.dtd</include>
+ <include>**/*.xsd</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>target/generated-sources/javacc</directory>
+ <includes>
+ <include>**/*.class</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <!-- generate java files from grammar -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <version>2.3-jboss-1</version>
+ <configuration>
+ <packageName>org/jboss/security/auth/login</packageName>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <isStatic>false</isStatic>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>javacc</goal>
+ </goals>
+ <id>javacc</id>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jaspi-api</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-security-acl-impl</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-javaee</artifactId>
+ <version>5.0.0.GA</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
+ <version>4.2.1.GA</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbossxacml</artifactId>
+ <version>2.0.3.CR2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.9</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jnpserver</artifactId>
+ <version>4.2.3.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>sun-opends</groupId>
+ <artifactId>OpenDS</artifactId>
+ <version>1.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>sleepycat</groupId>
+ <artifactId>je</artifactId>
+ <version>3.2.43</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,286 +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;
-
-import java.io.IOException;
-import java.security.Principal;
-import java.util.Map;
-import java.util.Set;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.spi.LoginModule;
-
-import org.jboss.logging.Logger;
-
-/** A simple implementation of LoginModule for use by JBoss clients for
- the establishment of the caller identity and credentials. This simply sets
- the SecurityAssociation principal to the value of the NameCallback
- filled in by the CallbackHandler, and the SecurityAssociation credential
- to the value of the PasswordCallback filled in by the CallbackHandler.
-
- It has the following options:
- <ul>
- <li>multi-threaded=[true|false]
- When the multi-threaded option is set to true, the SecurityAssociation.setServer()
- so that each login thread has its own principal and credential storage.
- <li>restore-login-identity=[true|false]
- When restore-login-identity is true, the SecurityAssociation principal
- and credential seen on entry to the login() method are saved and restored
- on either abort or logout. When false (the default), the abort and logout
- simply clears the SecurityAssociation. A restore-login-identity of true is
- needed if one need to change identities and then restore the original
- caller identity.
- <li>password-stacking=tryFirstPass|useFirstPass
- When password-stacking option is set, this module first looks for a shared
- username and password using "javax.security.auth.login.name" and
- "javax.security.auth.login.password" respectively. This allows a module configured
- prior to this one to establish a valid username and password that should be passed
- to JBoss.
- </ul>
-
- @author <a href="mailto:on at ibis.odessa.ua">Oleg Nitz</a>
- @author Scott.Stark at jboss.org
- @author Anil.Saldhana at redhat.com
- */
-public class ClientLoginModule implements LoginModule
-{
- private static Logger log = Logger.getLogger(ClientLoginModule.class);
- private Subject subject;
- private CallbackHandler callbackHandler;
- /** The principal set during login() */
- private Principal loginPrincipal;
- /** The credential set during login() */
- private Object loginCredential;
- /** Shared state between login modules */
- private Map<String,?> sharedState;
- /** Flag indicating if the shared password should be used */
- private boolean useFirstPass;
- /** Flag indicating if the SecurityAssociation existing at login should
- be restored on logout.
- */
- private boolean restoreLoginIdentity;
- private boolean trace;
-
- /** To restore prelogin identity **/
- private SecurityContext cachedSecurityContext;
-
- /** Initialize this LoginModule. This checks for the options:
- multi-threaded
- restore-login-identity
- password-stacking
- */
- public void initialize(Subject subject, CallbackHandler callbackHandler,
- Map<String,?> sharedState, Map<String,?> options)
- {
- this.trace = log.isTraceEnabled();
- this.subject = subject;
- this.callbackHandler = callbackHandler;
- this.sharedState = sharedState;
-
- //log securityDomain, if set.
- if(trace)
- log.trace("Security domain: " +
- (String)options.get(SecurityConstants.SECURITY_DOMAIN_OPTION));
-
- // Check for multi-threaded option
- String flag = (String) options.get("multi-threaded");
- if (Boolean.valueOf(flag).booleanValue() == true)
- {
- /* Turn on the server mode which uses thread local storage for
- the principal information.
- */
- if(trace)
- log.trace("Enabling multi-threaded mode");
- SecurityAssociationActions.setServer();
- }
- else
- {
- //Turn on the client side vm wide association
- SecurityAssociationActions.setClient();
- }
-
- flag = (String) options.get("restore-login-identity");
- restoreLoginIdentity = Boolean.valueOf(flag).booleanValue();
- if(trace)
- log.trace("Enabling restore-login-identity mode");
-
- /* Check for password sharing options. Any non-null value for
- password_stacking sets useFirstPass as this module has no way to
- validate any shared password.
- */
- String passwordStacking = (String) options.get("password-stacking");
- useFirstPass = passwordStacking != null;
- if(trace && useFirstPass)
- log.trace("Enabling useFirstPass mode");
- }
-
- /**
- * Method to authenticate a Subject (phase 1).
- */
- public boolean login() throws LoginException
- {
- if( trace )
- log.trace("Begin login");
- // If useFirstPass is true, look for the shared password
- if (useFirstPass == true)
- {
- try
- {
- Object name = sharedState.get("javax.security.auth.login.name");
- if ((name instanceof Principal) == false)
- {
- String username = name != null ? name.toString() : "";
- loginPrincipal = new SimplePrincipal(username);
- } else
- {
- loginPrincipal = (Principal) name;
- }
- loginCredential = sharedState.get("javax.security.auth.login.password");
- return true;
- }
- catch (Exception e)
- { // Dump the exception and continue
- log.debug("Failed to obtain shared state", e);
- }
- }
-
- /* There is no password sharing or we are the first login module. Get
- the username and password from the callback hander.
- */
- if (callbackHandler == null)
- throw new LoginException("Error: no CallbackHandler available " +
- "to garner authentication information from the user");
-
- PasswordCallback pc = new PasswordCallback("Password: ", false);
- NameCallback nc = new NameCallback("User name: ", "guest");
- Callback[] callbacks = {nc, pc};
- try
- {
- String username;
- char[] password = null;
- char[] tmpPassword;
-
- callbackHandler.handle(callbacks);
- username = nc.getName();
- loginPrincipal = new SimplePrincipal(username);
- tmpPassword = pc.getPassword();
- if (tmpPassword != null)
- {
- password = new char[tmpPassword.length];
- System.arraycopy(tmpPassword, 0, password, 0, tmpPassword.length);
- pc.clearPassword();
- }
- loginCredential = password;
- if( trace )
- {
- String credType = "null";
- if( loginCredential != null )
- credType = loginCredential.getClass().getName();
- log.trace("Obtained login: "+loginPrincipal
- +", credential.class: " + credType);
- }
- }
- catch (IOException ioe)
- {
- LoginException ex = new LoginException(ioe.toString());
- ex.initCause(ioe);
- throw ex;
- }
- catch (UnsupportedCallbackException uce)
- {
- LoginException ex = new LoginException("Error: " + uce.getCallback().toString() +
- ", not able to use this callback for username/password");
- ex.initCause(uce);
- throw ex;
- }
- if( trace )
- log.trace("End login");
- return true;
- }
-
- /**
- * Method to commit the authentication process (phase 2).
- */
- public boolean commit() throws LoginException
- {
- if( trace )
- log.trace("commit, subject="+subject);
- //Cache the existing security context
- this.cachedSecurityContext = SecurityAssociationActions.getSecurityContext();
-
- SecurityAssociationActions.setPrincipalInfo(loginPrincipal, loginCredential, subject);
-
- // Add the login principal to the subject if is not there
- Set<Principal> principals = subject.getPrincipals();
- if (principals.contains(loginPrincipal) == false)
- principals.add(loginPrincipal);
- return true;
- }
-
- /**
- * Method to abort the authentication process (phase 2).
- */
- public boolean abort() throws LoginException
- {
- if( trace )
- log.trace("abort");
- if( restoreLoginIdentity == true )
- {
- SecurityAssociationActions.popPrincipalInfo();
- SecurityAssociationActions.setSecurityContext(this.cachedSecurityContext);
- }
- else
- {
- // Clear the entire security association stack
- SecurityAssociationActions.clear();
- SecurityAssociationActions.setSecurityContext(null);
- }
-
- return true;
- }
-
- public boolean logout() throws LoginException
- {
- if( trace )
- log.trace("logout");
- if( restoreLoginIdentity == true )
- {
- SecurityAssociationActions.popPrincipalInfo();
- SecurityAssociationActions.setSecurityContext(this.cachedSecurityContext);
- }
- else
- {
- // Clear the entire security association stack
- SecurityAssociationActions.clear();
- SecurityAssociationActions.clearSecurityContext(null);
- }
- Set<Principal> principals = subject.getPrincipals();
- principals.remove(loginPrincipal);
- return true;
- }
-}
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java (from rev 92165, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/ClientLoginModule.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,291 @@
+/*
+* 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;
+
+import java.io.IOException;
+import java.security.Principal;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+import org.jboss.logging.Logger;
+
+/** A simple implementation of LoginModule for use by JBoss clients for
+ the establishment of the caller identity and credentials. This simply sets
+ the SecurityAssociation principal to the value of the NameCallback
+ filled in by the CallbackHandler, and the SecurityAssociation credential
+ to the value of the PasswordCallback filled in by the CallbackHandler.
+
+ It has the following options:
+ <ul>
+ <li>multi-threaded=[true|false]
+ When the multi-threaded option is set to true, the SecurityAssociation.setServer()
+ so that each login thread has its own principal and credential storage.
+ <li>restore-login-identity=[true|false]
+ When restore-login-identity is true, the SecurityAssociation principal
+ and credential seen on entry to the login() method are saved and restored
+ on either abort or logout. When false (the default), the abort and logout
+ simply clears the SecurityAssociation. A restore-login-identity of true is
+ needed if one need to change identities and then restore the original
+ caller identity.
+ <li>password-stacking=tryFirstPass|useFirstPass
+ When password-stacking option is set, this module first looks for a shared
+ username and password using "javax.security.auth.login.name" and
+ "javax.security.auth.login.password" respectively. This allows a module configured
+ prior to this one to establish a valid username and password that should be passed
+ to JBoss.
+ </ul>
+
+ @author <a href="mailto:on at ibis.odessa.ua">Oleg Nitz</a>
+ @author Scott.Stark at jboss.org
+ @author Anil.Saldhana at redhat.com
+ */
+public class ClientLoginModule implements LoginModule
+{
+ private static Logger log = Logger.getLogger(ClientLoginModule.class);
+ private Subject subject;
+ private CallbackHandler callbackHandler;
+ /** The principal set during login() */
+ private Principal loginPrincipal;
+ /** The credential set during login() */
+ private Object loginCredential;
+ /** Shared state between login modules */
+ private Map<String,?> sharedState;
+ /** Flag indicating if the shared password should be used */
+ private boolean useFirstPass;
+ /** Flag indicating if the SecurityAssociation existing at login should
+ be restored on logout.
+ */
+ private boolean restoreLoginIdentity;
+ private boolean trace;
+
+ /** To restore prelogin identity **/
+ private SecurityContext cachedSecurityContext;
+
+ /** Initialize this LoginModule. This checks for the options:
+ multi-threaded
+ restore-login-identity
+ password-stacking
+ */
+ public void initialize(Subject subject, CallbackHandler callbackHandler,
+ Map<String,?> sharedState, Map<String,?> options)
+ {
+ this.trace = log.isTraceEnabled();
+ this.subject = subject;
+ this.callbackHandler = callbackHandler;
+ this.sharedState = sharedState;
+
+ //log securityDomain, if set.
+ if(trace)
+ log.trace("Security domain: " +
+ (String)options.get(SecurityConstants.SECURITY_DOMAIN_OPTION));
+
+ // Check for multi-threaded option
+ String flag = (String) options.get("multi-threaded");
+ if (Boolean.valueOf(flag).booleanValue() == true)
+ {
+ /* Turn on the server mode which uses thread local storage for
+ the principal information.
+ */
+ if(trace)
+ log.trace("Enabling multi-threaded mode");
+ SecurityAssociationActions.setServer();
+ }
+
+ /**
+ * SECURITY-415: when the multi-threaded value is explictly set
+ * at false, then get into the client mode.
+ */
+ if(flag != null && flag.length() > 0 && "false".equalsIgnoreCase(flag))
+ {
+ SecurityAssociationActions.setClient();
+ }
+
+ flag = (String) options.get("restore-login-identity");
+ restoreLoginIdentity = Boolean.valueOf(flag).booleanValue();
+ if(trace)
+ log.trace("Enabling restore-login-identity mode");
+
+ /* Check for password sharing options. Any non-null value for
+ password_stacking sets useFirstPass as this module has no way to
+ validate any shared password.
+ */
+ String passwordStacking = (String) options.get("password-stacking");
+ useFirstPass = passwordStacking != null;
+ if(trace && useFirstPass)
+ log.trace("Enabling useFirstPass mode");
+
+ //Cache the existing security context
+ this.cachedSecurityContext = SecurityAssociationActions.getSecurityContext();
+ }
+
+ /**
+ * Method to authenticate a Subject (phase 1).
+ */
+ public boolean login() throws LoginException
+ {
+ if( trace )
+ log.trace("Begin login");
+ // If useFirstPass is true, look for the shared password
+ if (useFirstPass == true)
+ {
+ try
+ {
+ Object name = sharedState.get("javax.security.auth.login.name");
+ if ((name instanceof Principal) == false)
+ {
+ String username = name != null ? name.toString() : "";
+ loginPrincipal = new SimplePrincipal(username);
+ } else
+ {
+ loginPrincipal = (Principal) name;
+ }
+ loginCredential = sharedState.get("javax.security.auth.login.password");
+ return true;
+ }
+ catch (Exception e)
+ { // Dump the exception and continue
+ log.debug("Failed to obtain shared state", e);
+ }
+ }
+
+ /* There is no password sharing or we are the first login module. Get
+ the username and password from the callback hander.
+ */
+ if (callbackHandler == null)
+ throw new LoginException("Error: no CallbackHandler available " +
+ "to garner authentication information from the user");
+
+ PasswordCallback pc = new PasswordCallback("Password: ", false);
+ NameCallback nc = new NameCallback("User name: ", "guest");
+ Callback[] callbacks = {nc, pc};
+ try
+ {
+ String username;
+ char[] password = null;
+ char[] tmpPassword;
+
+ callbackHandler.handle(callbacks);
+ username = nc.getName();
+ loginPrincipal = new SimplePrincipal(username);
+ tmpPassword = pc.getPassword();
+ if (tmpPassword != null)
+ {
+ password = new char[tmpPassword.length];
+ System.arraycopy(tmpPassword, 0, password, 0, tmpPassword.length);
+ pc.clearPassword();
+ }
+ loginCredential = password;
+ if( trace )
+ {
+ String credType = "null";
+ if( loginCredential != null )
+ credType = loginCredential.getClass().getName();
+ log.trace("Obtained login: "+loginPrincipal
+ +", credential.class: " + credType);
+ }
+ }
+ catch (IOException ioe)
+ {
+ LoginException ex = new LoginException(ioe.toString());
+ ex.initCause(ioe);
+ throw ex;
+ }
+ catch (UnsupportedCallbackException uce)
+ {
+ LoginException ex = new LoginException("Error: " + uce.getCallback().toString() +
+ ", not able to use this callback for username/password");
+ ex.initCause(uce);
+ throw ex;
+ }
+ if( trace )
+ log.trace("End login");
+ return true;
+ }
+
+ /**
+ * Method to commit the authentication process (phase 2).
+ */
+ public boolean commit() throws LoginException
+ {
+ if( trace )
+ log.trace("commit, subject="+subject);
+
+ SecurityAssociationActions.setPrincipalInfo(loginPrincipal, loginCredential, subject);
+
+ // Add the login principal to the subject if is not there
+ Set<Principal> principals = subject.getPrincipals();
+ if (principals.contains(loginPrincipal) == false)
+ principals.add(loginPrincipal);
+ return true;
+ }
+
+ /**
+ * Method to abort the authentication process (phase 2).
+ */
+ public boolean abort() throws LoginException
+ {
+ if( trace )
+ log.trace("abort");
+ if( restoreLoginIdentity == true )
+ {
+ SecurityAssociationActions.popPrincipalInfo();
+ SecurityAssociationActions.setSecurityContext(this.cachedSecurityContext);
+ }
+ else
+ {
+ // Clear the entire security association stack
+ SecurityAssociationActions.clear();
+ SecurityAssociationActions.popPrincipalInfo(); //SECURITY-339
+ }
+
+ return true;
+ }
+
+ public boolean logout() throws LoginException
+ {
+ if( trace )
+ log.trace("logout");
+ if( restoreLoginIdentity == true )
+ {
+ SecurityAssociationActions.popPrincipalInfo();
+ SecurityAssociationActions.setSecurityContext(this.cachedSecurityContext);
+ }
+ else
+ {
+ // Clear the entire security association stack
+ SecurityAssociationActions.clear();
+ SecurityAssociationActions.clearSecurityContext(null);
+ }
+ Set<Principal> principals = subject.getPrincipals();
+ principals.remove(loginPrincipal);
+ return true;
+ }
+}
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,110 +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 java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.crypto.Cipher;
-import javax.management.ObjectName;
-
-import org.jboss.security.config.SecurityConfiguration;
-
-/**
- * PriviledgedActions used by login modules for decoding passwords
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-class DecodeAction implements PrivilegedExceptionAction<Object>
-{
- /** The permission required to access decode, decode64 */
- private static final RuntimePermission decodePermission =
- new RuntimePermission("org.jboss.security.auth.spi.DecodeAction.decode");
-
- String password;
- ObjectName serviceName;
-
- DecodeAction(String password, ObjectName serviceName)
- {
- this.password = password;
- this.serviceName = serviceName;
- }
-
- /**
- *
- * @return
- * @throws Exception
- */
- public Object run() throws Exception
- {
- // Invoke the decodeb64 op
- byte[] secret = decode64(password);
- // Convert to UTF-8 base char array
- String secretPassword = new String(secret, "UTF-8");
- return secretPassword.toCharArray();
- }
-
- private byte[] decode64(String secret)
- throws Exception
- {
- byte[] encoding = Util.fromb64(secret);
- byte[] decode = decode(encoding);
- return decode;
- }
-
- /** Decrypt the secret using the cipherKey.
- *
- * @param secret - the encrypted secret to decrypt.
- * @return the decrypted secret
- * @throws Exception
- */
- private byte[] decode(byte[] secret)
- throws Exception
- {
- SecurityManager sm = System.getSecurityManager();
- if( sm != null )
- sm.checkPermission(decodePermission);
-
- Cipher cipher = Cipher.getInstance(SecurityConfiguration.getCipherAlgorithm());
- cipher.init(Cipher.DECRYPT_MODE, SecurityConfiguration.getCipherKey(),
- SecurityConfiguration.getCipherSpec());
- byte[] decode = cipher.doFinal(secret);
- return decode;
- }
-
- static char[] decode(String password, ObjectName serviceName)
- throws Exception
- {
- DecodeAction action = new DecodeAction(password, serviceName);
- try
- {
- char[] decode = (char[]) AccessController.doPrivileged(action);
- return decode;
- }
- catch(PrivilegedActionException e)
- {
- throw e.getException();
- }
- }
-}
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java (from rev 91979, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,109 @@
+/*
+* 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 java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.crypto.CryptoUtil;
+import org.jboss.mx.util.MBeanServerLocator;
+
+/**
+ * PriviledgedActions used by login modules for decoding passwords
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+class DecodeAction implements PrivilegedExceptionAction<Object>
+{
+ /** The permission required to access decode, decode64 */
+ private static final RuntimePermission decodePermission =
+ new RuntimePermission("org.jboss.security.auth.spi.DecodeAction.decode");
+
+ String password;
+ ObjectName serviceName;
+
+ DecodeAction(String password, ObjectName serviceName)
+ {
+ this.password = password;
+ this.serviceName = serviceName;
+ }
+
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ public Object run() throws Exception
+ {
+ // Invoke the decodeb64 op
+ byte[] secret = decode64(password);
+ // Convert to UTF-8 base char array
+ String secretPassword = new String(secret, "UTF-8");
+ return secretPassword.toCharArray();
+ }
+
+ private byte[] decode64(String secret)
+ throws Exception
+ {
+ byte[] encoding = CryptoUtil.fromb64(secret);
+ byte[] decode = decode(encoding);
+ return decode;
+ }
+
+ /** Decrypt the secret using the cipherKey.
+ *
+ * @param secret - the encrypted secret to decrypt.
+ * @return the decrypted secret
+ * @throws Exception
+ */
+ private byte[] decode(byte[] passw)
+ throws Exception
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if( sm != null )
+ sm.checkPermission(decodePermission);
+
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ return (byte[]) server.invoke(serviceName, "decode64", new Object[] {passw},
+ new String[] {byte[].class.getName()});
+ }
+
+ static char[] decode(String password, ObjectName serviceName)
+ throws Exception
+ {
+ DecodeAction action = new DecodeAction(password, serviceName);
+ try
+ {
+ char[] decode = (char[]) AccessController.doPrivileged(action);
+ return decode;
+ }
+ catch(PrivilegedActionException e)
+ {
+ throw e.getException();
+ }
+ }
+}
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/SimpleServerLoginModule.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/SimpleServerLoginModule.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/SimpleServerLoginModule.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,90 +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 java.security.Principal;
-import java.security.acl.Group;
-
-import javax.security.auth.login.LoginException;
-
-import org.jboss.security.SimpleGroup;
-import org.jboss.security.SimplePrincipal;
-
-/**
- * A simple server login module useful to quick setup of security for testing
- * purposes. It implements the following simple algorithm:
- * <ul>
- * <li> if password is null, authenticate the user and assign an identity of "guest"
- * and a role of "guest".
- * <li> else if password is equal to the user name, assign an identity equal to
- * the username and both "user" and "guest" roles
- * <li> else authentication fails.
- * </ul>
- *
- * @author <a href="on at ibis.odessa.ua">Oleg Nitz</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class SimpleServerLoginModule extends UsernamePasswordLoginModule
-{
- private SimplePrincipal user;
- private boolean guestOnly;
-
- protected Principal getIdentity()
- {
- Principal principal = user;
- if( principal == null )
- principal = super.getIdentity();
- return principal;
- }
-
- protected boolean validatePassword(String inputPassword, String expectedPassword)
- {
- boolean isValid = false;
- if( inputPassword == null )
- {
- guestOnly = true;
- isValid = true;
- user = new SimplePrincipal("guest");
- }
- else
- {
- isValid = inputPassword.equals(expectedPassword);
- }
- return isValid;
- }
-
- protected Group[] getRoleSets() throws LoginException
- {
- Group[] roleSets = {new SimpleGroup("Roles")};
- if( guestOnly == false )
- roleSets[0].addMember(new SimplePrincipal("user"));
- roleSets[0].addMember(new SimplePrincipal("guest"));
- return roleSets;
- }
-
- protected String getUsersPassword() throws LoginException
- {
- return getUsername();
- }
-
-}
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/SimpleServerLoginModule.java (from rev 92165, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/SimpleServerLoginModule.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/SimpleServerLoginModule.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/auth/spi/SimpleServerLoginModule.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,98 @@
+/*
+* 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 java.security.Principal;
+import java.security.acl.Group;
+import java.util.Set;
+
+import javax.security.auth.login.LoginException;
+
+import org.jboss.security.SimpleGroup;
+import org.jboss.security.SimplePrincipal;
+
+/**
+ * A simple server login module useful to quick setup of security for testing
+ * purposes. It implements the following simple algorithm:
+ * <ul>
+ * <li> if password is null, authenticate the user and assign an identity of "guest"
+ * and a role of "guest".
+ * <li> else if password is equal to the user name, assign an identity equal to
+ * the username and both "user" and "guest" roles
+ * <li> else authentication fails.
+ * </ul>
+ *
+ * @author <a href="on at ibis.odessa.ua">Oleg Nitz</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class SimpleServerLoginModule extends UsernamePasswordLoginModule
+{
+ private SimplePrincipal user;
+ private boolean guestOnly;
+
+ protected Principal getIdentity()
+ {
+ Principal principal = user;
+ if( principal == null )
+ principal = super.getIdentity();
+ return principal;
+ }
+
+ protected boolean validatePassword(String inputPassword, String expectedPassword)
+ {
+ boolean isValid = false;
+ if( inputPassword == null )
+ {
+ guestOnly = true;
+ isValid = true;
+ user = new SimplePrincipal("guest");
+ }
+ else
+ {
+ isValid = inputPassword.equals(expectedPassword);
+ }
+ return isValid;
+ }
+
+ protected Group[] getRoleSets() throws LoginException
+ {
+ Group[] roleSets = {new SimpleGroup("Roles")};
+ if( guestOnly == false )
+ roleSets[0].addMember(new SimplePrincipal("user"));
+ roleSets[0].addMember(new SimplePrincipal("guest"));
+ return roleSets;
+ }
+
+ protected String getUsersPassword() throws LoginException
+ {
+ return getUsername();
+ }
+
+ @Override
+ public boolean logout() throws LoginException
+ {
+ Group[] groups = this.getRoleSets();
+ subject.getPrincipals().remove(groups[0]);
+ return super.logout();
+ }
+}
\ No newline at end of file
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,362 +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.security.Principal;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.security.auth.login.BaseAuthenticationInfo;
-import org.jboss.security.identity.RoleGroup;
-
-// $Id$
-
-/**
- * Application Policy Information Holder - Authentication - Authorization - Audit - Mapping
- *
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Jun 9, 2006
- * @version $Revision$
- */
-public class ApplicationPolicy
-{
- private final String name;
-
- private BaseAuthenticationInfo authenticationInfo;
-
- private ACLInfo aclInfo;
-
- private AuthorizationInfo authorizationInfo;
-
- private AuditInfo auditInfo;
-
- private final Map<String, MappingInfo> mappingInfos = new HashMap<String, MappingInfo>();
-
- private IdentityTrustInfo identityTrustInfo;
-
- // Base application policy (if any)
- private String baseApplicationPolicyName;
-
- // Parent PolicyConfig
- private PolicyConfig policyConfig;
-
- public ApplicationPolicy(String theName)
- {
- if (theName == null)
- throw new IllegalArgumentException("name is null");
- this.name = theName;
- }
-
- public ApplicationPolicy(String theName, BaseAuthenticationInfo info)
- {
- this(theName);
- authenticationInfo = info;
- }
-
- public ApplicationPolicy(String theName, AuthorizationInfo info)
- {
- this(theName);
- authorizationInfo = info;
- }
-
- public ApplicationPolicy(String theName, BaseAuthenticationInfo info, AuthorizationInfo info2)
- {
- this(theName);
- authenticationInfo = info;
- authorizationInfo = info2;
- }
-
- public ACLInfo getAclInfo()
- {
- ACLInfo info = null;
- ApplicationPolicy basePolicy = this.getBaseApplicationPolicy();
- if (basePolicy != null)
- info = basePolicy.getAclInfo();
- if (info != null && this.aclInfo == null)
- return info;
- else if (info != null)
- return (ACLInfo) this.aclInfo.merge(info);
- else
- return aclInfo;
- }
-
- public void setAclInfo(ACLInfo aclInfo)
- {
- this.aclInfo = aclInfo;
- }
-
- public BaseAuthenticationInfo getAuthenticationInfo()
- {
- BaseAuthenticationInfo bai = null;
- ApplicationPolicy ap = this.getBaseApplicationPolicy();
- if (ap != null)
- bai = ap.getAuthenticationInfo();
- if (bai != null && authenticationInfo == null)
- return bai;
- else if (bai != null)
- return (BaseAuthenticationInfo) authenticationInfo.merge(bai);
- else
- return authenticationInfo;
- }
-
- public void setAuthenticationInfo(BaseAuthenticationInfo authenticationInfo)
- {
- this.authenticationInfo = authenticationInfo;
- }
-
- public AuthorizationInfo getAuthorizationInfo()
- {
- AuthorizationInfo bai = null;
- ApplicationPolicy ap = this.getBaseApplicationPolicy();
- if (ap != null)
- bai = ap.getAuthorizationInfo();
- if (bai != null && authorizationInfo == null)
- return bai;
- else if (bai != null)
- return (AuthorizationInfo) authorizationInfo.merge(bai);
- else
- return authorizationInfo;
- }
-
- public void setAuthorizationInfo(AuthorizationInfo authorizationInfo)
- {
- this.authorizationInfo = authorizationInfo;
- }
-
- /**
- * <p>
- * Gets the {@code MappingInfo} object that contains the entries that will be used to map roles.
- * </p>
- *
- * @return the {@code MappingInfo} that must be used when mapping roles.
- * @deprecated use {@link ApplicationPolicy#getMappingInfo("role")} instead.
- */
- @Deprecated
- public MappingInfo getRoleMappingInfo()
- {
- return this.getMappingInfo("role");
- }
-
- /**
- * <p>
- * Sets the {@code MappingInfo} object that must be used when mapping roles.
- * </p>
- *
- * @param roleMappingInfo the {@code MappingInfo} instance to be set.
- * @deprecated use {@link ApplicationPolicy#setMappingInfo("role", MappingInfo)} instead.
- */
- @Deprecated
- public void setRoleMappingInfo(MappingInfo roleMappingInfo)
- {
- this.setMappingInfo("role", roleMappingInfo);
- }
-
- /**
- * <p>
- * Gets the {@code MappingInfo} object that contains the entries that will be used to map principals.
- * </p>
- *
- * @return the {@code MappingInfo} that must be used when mapping principals.
- * @deprecated use {@link ApplicationPolicy#getMappingInfo("principal")} instead.
- */
- @Deprecated
- public MappingInfo getPrincipalMappingInfo()
- {
- return this.getMappingInfo("principal");
- }
-
- /**
- * <p>
- * Sets the {@code MappingInfo} object that must be used when mapping principals.
- * </p>
- *
- * @param roleMappingInfo the {@code MappingInfo} instance to be set.
- * @deprecated use {@link ApplicationPolicy#setMappingInfo("principal", MappingInfo)} instead.
- */
- @Deprecated
- public void setPrincipalMappingInfo(MappingInfo principalMappingInfo)
- {
- this.setMappingInfo("principal", principalMappingInfo);
- }
-
- /**
- * <p>
- * Gets the {@code MappingInfo} instance that can map objects of the specified class.
- * </p>
- *
- * @param t the class of the objects that are to be mapped.
- * @return the {@code MappingInfo} instance that must be used to map objects of the specified class.
- * @deprecated use {@link ApplicationPolicy#getMappingInfo(String)} instead.
- */
- @Deprecated
- public <T> MappingInfo getMappingInfo(Class<T> t)
- {
- if (t == RoleGroup.class)
- return this.getRoleMappingInfo();
- if (t == Principal.class)
- return this.getPrincipalMappingInfo();
- throw new IllegalStateException("No mapping information available for type:" + t);
- }
-
- /**
- * <p>
- * Gets the {@code MappingInfo} instance that can perform the mappings of the specified type.
- * </p>
- *
- * @param mappingType a {@code String} representing the type of the mappings that are to be performed. This
- * {@code String} must match the value of the {@code type} attribute of the {@code mapping-module} that
- * has been configured in the application policy. For example, consider the following mapping policy:
- *
- * <pre>
- * <application-policy name="test">
- * <authentication>
- * ...
- * </authentication>
- * <mapping>
- * <mapping-module code = "org.jboss.test.mapping.MappingModule1" type="role">
- * <module-option name = "option1">value1</module-option>
- * </mapping-module>
- * <mapping-module code = "org.jboss.test.mapping.MappingModule2" type="principal">
- * <module-option name = "option2">value2</module-option>
- * </mapping-module>
- * </mapping> while a
- * </application-policy>
- * </pre>
- *
- * Executing this method with {@code "role"} as parameter would return a {@code MappingInfo} that is capable of
- * mapping roles using the {@code MappingModule1}. Likewise, executing this method with {@code "principal"} as
- * parameter would return a {@code MappingInfo} that can map principals using the {@code MappingModule2}.
- * @return the {@code MappingInfo} instance that can perform the mappings of the specified type, or {@code null} if
- * no suitable {@code MappingInfo} can be found.
- */
- public MappingInfo getMappingInfo(String mappingType)
- {
- mappingType = mappingType.toLowerCase();
- MappingInfo bai = null;
- ApplicationPolicy ap = this.getBaseApplicationPolicy();
- if (ap != null)
- bai = ap.getMappingInfo(mappingType);
-
- MappingInfo mappings = this.mappingInfos.get(mappingType);
- if (bai != null && mappings == null)
- return bai;
- else if (bai != null)
- return (MappingInfo) mappings.merge(bai);
- else
- return mappings;
- }
-
- /**
- * <p>
- * Sets the {@code MappingInfo} that must be used to perform the mappings of the specified type.
- * </p>
- *
- * @param mappingType the type of mappings that can be performed by the {@code MappingInfo}.
- * @param info a reference to the {@code MappingInfo} instance to be set.
- */
- public void setMappingInfo(String mappingType, MappingInfo info)
- {
- // if there is a registered info for the specified type, merge the modules.
- if(this.mappingInfos.containsKey(mappingType))
- this.mappingInfos.get(mappingType).add(info.getModuleEntries());
- else
- this.mappingInfos.put(mappingType, info);
- }
-
- public AuditInfo getAuditInfo()
- {
- AuditInfo bai = null;
- ApplicationPolicy ap = this.getBaseApplicationPolicy();
- if (ap != null)
- bai = ap.getAuditInfo();
-
- if (bai != null && auditInfo == null)
- return bai;
- else if (bai != null)
- return (AuditInfo) auditInfo.merge(bai);
- else
- return auditInfo;
- }
-
- public void setAuditInfo(AuditInfo auditInfo)
- {
- this.auditInfo = auditInfo;
- }
-
- public IdentityTrustInfo getIdentityTrustInfo()
- {
- IdentityTrustInfo bai = null;
- ApplicationPolicy ap = this.getBaseApplicationPolicy();
- if (ap != null)
- bai = ap.getIdentityTrustInfo();
-
- if (bai != null && identityTrustInfo == null)
- return bai;
- else if (bai != null)
- return (IdentityTrustInfo) identityTrustInfo.merge(bai);
- else
- return identityTrustInfo;
- }
-
- public void setIdentityTrustInfo(IdentityTrustInfo identityTrustInfo)
- {
- this.identityTrustInfo = identityTrustInfo;
- }
-
- public String getBaseApplicationPolicyName()
- {
- return baseApplicationPolicyName;
- }
-
- public void setBaseApplicationPolicyName(String baseApplicationPolicy)
- {
- this.baseApplicationPolicyName = baseApplicationPolicy;
- }
-
- public String getName()
- {
- return name;
- }
-
- public PolicyConfig getPolicyConfig()
- {
- return policyConfig;
- }
-
- public void setPolicyConfig(PolicyConfig policyConfig)
- {
- this.policyConfig = policyConfig;
- }
-
- private ApplicationPolicy getBaseApplicationPolicy()
- {
- ApplicationPolicy ap = null;
- if (this.baseApplicationPolicyName != null)
- {
- ap = this.policyConfig.get(this.baseApplicationPolicyName);
- // The base application policy may exist in a different location
- if (ap == null)
- ap = SecurityConfiguration.getApplicationPolicy(this.baseApplicationPolicyName);
- }
- return ap;
- }
-}
\ No newline at end of file
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/ApplicationPolicy.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,363 @@
+/*
+ * 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.security.Principal;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.security.auth.login.BaseAuthenticationInfo;
+import org.jboss.security.identity.RoleGroup;
+
+// $Id$
+
+/**
+ * Application Policy Information Holder - Authentication - Authorization - Audit - Mapping
+ *
+ * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ * @since Jun 9, 2006
+ * @version $Revision$
+ */
+public class ApplicationPolicy
+{
+ private final String name;
+
+ private BaseAuthenticationInfo authenticationInfo;
+
+ private ACLInfo aclInfo;
+
+ private AuthorizationInfo authorizationInfo;
+
+ private AuditInfo auditInfo;
+
+ private final Map<String, MappingInfo> mappingInfos = new HashMap<String, MappingInfo>();
+
+ private IdentityTrustInfo identityTrustInfo;
+
+ // Base application policy (if any)
+ private String baseApplicationPolicyName;
+
+ // Parent PolicyConfig
+ private PolicyConfig policyConfig;
+
+ public ApplicationPolicy(String theName)
+ {
+ if (theName == null)
+ throw new IllegalArgumentException("name is null");
+ this.name = theName;
+ }
+
+ public ApplicationPolicy(String theName, BaseAuthenticationInfo info)
+ {
+ this(theName);
+ authenticationInfo = info;
+ }
+
+ public ApplicationPolicy(String theName, AuthorizationInfo info)
+ {
+ this(theName);
+ authorizationInfo = info;
+ }
+
+ public ApplicationPolicy(String theName, BaseAuthenticationInfo info, AuthorizationInfo info2)
+ {
+ this(theName);
+ authenticationInfo = info;
+ authorizationInfo = info2;
+ }
+
+ public ACLInfo getAclInfo()
+ {
+ ACLInfo info = null;
+ ApplicationPolicy basePolicy = this.getBaseApplicationPolicy();
+ if (basePolicy != null)
+ info = basePolicy.getAclInfo();
+ if (info != null && this.aclInfo == null)
+ return info;
+ else if (info != null)
+ return (ACLInfo) this.aclInfo.merge(info);
+ else
+ return aclInfo;
+ }
+
+ public void setAclInfo(ACLInfo aclInfo)
+ {
+ this.aclInfo = aclInfo;
+ }
+
+ public BaseAuthenticationInfo getAuthenticationInfo()
+ {
+ BaseAuthenticationInfo bai = null;
+ ApplicationPolicy ap = this.getBaseApplicationPolicy();
+ if (ap != null)
+ bai = ap.getAuthenticationInfo();
+ if (bai != null && authenticationInfo == null)
+ return bai;
+ else if (bai != null)
+ return (BaseAuthenticationInfo) authenticationInfo.merge(bai);
+ else
+ return authenticationInfo;
+ }
+
+ public void setAuthenticationInfo(BaseAuthenticationInfo authenticationInfo)
+ {
+ this.authenticationInfo = authenticationInfo;
+ }
+
+ public AuthorizationInfo getAuthorizationInfo()
+ {
+ AuthorizationInfo bai = null;
+ ApplicationPolicy ap = this.getBaseApplicationPolicy();
+ if (ap != null)
+ bai = ap.getAuthorizationInfo();
+ if (bai != null && authorizationInfo == null)
+ return bai;
+ else if (bai != null)
+ return (AuthorizationInfo) authorizationInfo.merge(bai);
+ else
+ return authorizationInfo;
+ }
+
+ public void setAuthorizationInfo(AuthorizationInfo authorizationInfo)
+ {
+ this.authorizationInfo = authorizationInfo;
+ }
+
+ /**
+ * <p>
+ * Gets the {@code MappingInfo} object that contains the entries that will be used to map roles.
+ * </p>
+ *
+ * @return the {@code MappingInfo} that must be used when mapping roles.
+ * @deprecated use {@link ApplicationPolicy#getMappingInfo("role")} instead.
+ */
+ @Deprecated
+ public MappingInfo getRoleMappingInfo()
+ {
+ return this.getMappingInfo("role");
+ }
+
+ /**
+ * <p>
+ * Sets the {@code MappingInfo} object that must be used when mapping roles.
+ * </p>
+ *
+ * @param roleMappingInfo the {@code MappingInfo} instance to be set.
+ * @deprecated use {@link ApplicationPolicy#setMappingInfo("role", MappingInfo)} instead.
+ */
+ @Deprecated
+ public void setRoleMappingInfo(MappingInfo roleMappingInfo)
+ {
+ this.setMappingInfo("role", roleMappingInfo);
+ }
+
+ /**
+ * <p>
+ * Gets the {@code MappingInfo} object that contains the entries that will be used to map principals.
+ * </p>
+ *
+ * @return the {@code MappingInfo} that must be used when mapping principals.
+ * @deprecated use {@link ApplicationPolicy#getMappingInfo("principal")} instead.
+ */
+ @Deprecated
+ public MappingInfo getPrincipalMappingInfo()
+ {
+ return this.getMappingInfo("principal");
+ }
+
+ /**
+ * <p>
+ * Sets the {@code MappingInfo} object that must be used when mapping principals.
+ * </p>
+ *
+ * @param roleMappingInfo the {@code MappingInfo} instance to be set.
+ * @deprecated use {@link ApplicationPolicy#setMappingInfo("principal", MappingInfo)} instead.
+ */
+ @Deprecated
+ public void setPrincipalMappingInfo(MappingInfo principalMappingInfo)
+ {
+ this.setMappingInfo("principal", principalMappingInfo);
+ }
+
+ /**
+ * <p>
+ * Gets the {@code MappingInfo} instance that can map objects of the specified class.
+ * </p>
+ *
+ * @param t the class of the objects that are to be mapped.
+ * @return the {@code MappingInfo} instance that must be used to map objects of the specified class.
+ * @deprecated use {@link ApplicationPolicy#getMappingInfo(String)} instead.
+ */
+ @Deprecated
+ public <T> MappingInfo getMappingInfo(Class<T> t)
+ {
+ if (t == RoleGroup.class)
+ return this.getRoleMappingInfo();
+ if (t == Principal.class)
+ return this.getPrincipalMappingInfo();
+ throw new IllegalStateException("No mapping information available for type:" + t);
+ }
+
+ /**
+ * <p>
+ * Gets the {@code MappingInfo} instance that can perform the mappings of the specified type.
+ * </p>
+ *
+ * @param mappingType a {@code String} representing the type of the mappings that are to be performed. This
+ * {@code String} must match the value of the {@code type} attribute of the {@code mapping-module} that
+ * has been configured in the application policy. For example, consider the following mapping policy:
+ *
+ * <pre>
+ * <application-policy name="test">
+ * <authentication>
+ * ...
+ * </authentication>
+ * <mapping>
+ * <mapping-module code = "org.jboss.test.mapping.MappingModule1" type="role">
+ * <module-option name = "option1">value1</module-option>
+ * </mapping-module>
+ * <mapping-module code = "org.jboss.test.mapping.MappingModule2" type="principal">
+ * <module-option name = "option2">value2</module-option>
+ * </mapping-module>
+ * </mapping> while a
+ * </application-policy>
+ * </pre>
+ *
+ * Executing this method with {@code "role"} as parameter would return a {@code MappingInfo} that is capable of
+ * mapping roles using the {@code MappingModule1}. Likewise, executing this method with {@code "principal"} as
+ * parameter would return a {@code MappingInfo} that can map principals using the {@code MappingModule2}.
+ * @return the {@code MappingInfo} instance that can perform the mappings of the specified type, or {@code null} if
+ * no suitable {@code MappingInfo} can be found.
+ */
+ public MappingInfo getMappingInfo(String mappingType)
+ {
+ mappingType = mappingType.toLowerCase();
+ MappingInfo bai = null;
+ ApplicationPolicy ap = this.getBaseApplicationPolicy();
+ if (ap != null)
+ bai = ap.getMappingInfo(mappingType);
+
+ MappingInfo mappings = this.mappingInfos.get(mappingType);
+ if (bai != null && mappings == null)
+ return bai;
+ else if (bai != null)
+ return (MappingInfo) mappings.merge(bai);
+ else
+ return mappings;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code MappingInfo} that must be used to perform the mappings of the specified type.
+ * </p>
+ *
+ * @param mappingType the type of mappings that can be performed by the {@code MappingInfo}.
+ * @param info a reference to the {@code MappingInfo} instance to be set.
+ */
+ public void setMappingInfo(String mappingType, MappingInfo info)
+ {
+ mappingType = mappingType.toLowerCase();
+ // if there is a registered info for the specified type, merge the modules.
+ if(this.mappingInfos.containsKey(mappingType))
+ this.mappingInfos.get(mappingType).add(info.getModuleEntries());
+ else
+ this.mappingInfos.put(mappingType, info);
+ }
+
+ public AuditInfo getAuditInfo()
+ {
+ AuditInfo bai = null;
+ ApplicationPolicy ap = this.getBaseApplicationPolicy();
+ if (ap != null)
+ bai = ap.getAuditInfo();
+
+ if (bai != null && auditInfo == null)
+ return bai;
+ else if (bai != null)
+ return (AuditInfo) auditInfo.merge(bai);
+ else
+ return auditInfo;
+ }
+
+ public void setAuditInfo(AuditInfo auditInfo)
+ {
+ this.auditInfo = auditInfo;
+ }
+
+ public IdentityTrustInfo getIdentityTrustInfo()
+ {
+ IdentityTrustInfo bai = null;
+ ApplicationPolicy ap = this.getBaseApplicationPolicy();
+ if (ap != null)
+ bai = ap.getIdentityTrustInfo();
+
+ if (bai != null && identityTrustInfo == null)
+ return bai;
+ else if (bai != null)
+ return (IdentityTrustInfo) identityTrustInfo.merge(bai);
+ else
+ return identityTrustInfo;
+ }
+
+ public void setIdentityTrustInfo(IdentityTrustInfo identityTrustInfo)
+ {
+ this.identityTrustInfo = identityTrustInfo;
+ }
+
+ public String getBaseApplicationPolicyName()
+ {
+ return baseApplicationPolicyName;
+ }
+
+ public void setBaseApplicationPolicyName(String baseApplicationPolicy)
+ {
+ this.baseApplicationPolicyName = baseApplicationPolicy;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public PolicyConfig getPolicyConfig()
+ {
+ return policyConfig;
+ }
+
+ public void setPolicyConfig(PolicyConfig policyConfig)
+ {
+ this.policyConfig = policyConfig;
+ }
+
+ private ApplicationPolicy getBaseApplicationPolicy()
+ {
+ ApplicationPolicy ap = null;
+ if (this.baseApplicationPolicyName != null)
+ {
+ ap = this.policyConfig.get(this.baseApplicationPolicyName);
+ // The base application policy may exist in a different location
+ if (ap == null)
+ ap = SecurityConfiguration.getApplicationPolicy(this.baseApplicationPolicyName);
+ }
+ return ap;
+ }
+}
\ No newline at end of file
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/AttributeMappingInfo.java (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/config/AttributeMappingInfo.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/AttributeMappingInfo.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/config/AttributeMappingInfo.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,34 @@
+/*
+ * 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.config;
+
+/**
+ * Mapping Info for Attributes
+ * @author Anil.Saldhana at redhat.com
+ */
+public class AttributeMappingInfo extends MappingInfo
+{
+ public AttributeMappingInfo(String name)
+ {
+ super(name);
+ }
+}
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute)
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,530 +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.plugins;
-
-import static org.jboss.security.SecurityConstants.ROLES_IDENTIFIER;
-
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.AnybodyPrincipal;
-import org.jboss.security.AuthorizationManager;
-import org.jboss.security.NobodyPrincipal;
-import org.jboss.security.RunAs;
-import org.jboss.security.SecurityConstants;
-import org.jboss.security.SecurityContext;
-import org.jboss.security.SecurityRolesAssociation;
-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;
-import org.jboss.security.identity.plugins.SimpleRoleGroup;
-import org.jboss.security.mapping.MappingContext;
-import org.jboss.security.mapping.MappingManager;
-import org.jboss.security.plugins.acl.JBossACLContext;
-import org.jboss.security.plugins.authorization.JBossAuthorizationContext;
-import org.jboss.util.NotImplementedException;
-
-//$Id$
-
-/**
- * Authorization Manager implementation
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Jan 3, 2006
- * @version $Revision$
- */
-public class JBossAuthorizationManager
-implements AuthorizationManager
-{
- private final String securityDomain;
-
- private static Logger log = Logger.getLogger(JBossAuthorizationManager.class);
-
- protected boolean trace = log.isTraceEnabled();
-
- private AuthorizationContext authorizationContext = null;
-
- private ACLContext aclContext = null;
-
- //Lock deals with synchronization of authorizationContext usage
- private final Lock lock = new ReentrantLock();
-
- public JBossAuthorizationManager(String securityDomainName)
- {
- this.securityDomain = securityDomainName;
- }
-
- /**
- * @see AuthorizationManager#authorize(Resource)
- */
- public int authorize(Resource resource) throws AuthorizationException
- {
- validateResource(resource);
- Subject subject = SubjectActions.getActiveSubject();
- return internalAuthorization(resource,subject, null);
- }
-
- /**
- * @see AuthorizationManager#authorize(Resource, Subject)
- */
- public int authorize(Resource resource, Subject subject)
- throws AuthorizationException
- {
- return internalAuthorization(resource, subject, null);
- }
-
- /**
- * @see AuthorizationManager#authorize(Resource, Subject, RoleGroup)
- */
- public int authorize(Resource resource, Subject subject,
- RoleGroup role) throws AuthorizationException
- {
- this.validateResource(resource);
- return internalAuthorization(resource, subject, role);
- }
-
- /**
- * @see AuthorizationManager#authorize(Resource, Subject, Group)
- */
- public int authorize(Resource resource, Subject subject,
- Group roleGroup) throws AuthorizationException
- {
- this.validateResource(resource);
- 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
- by the SecurityAssociation.getSubject() method and then creates a
- SimplePrincipal for each name in roleNames. If the role is a member of the
- Roles group, then the user has the role. This requires that the caller
- establish the correct SecurityAssociation subject prior to calling this
- method. In the past this was done as a side-effect of an isValid() call,
- but this is no longer the case.
-
- @param principal - ignored. The current authenticated Subject determines
- the active user and assigned user roles.
- @param rolePrincipals - a Set of Principals for the roles to check.
-
- @see java.security.acl.Group;
- @see Subject#getPrincipals()
- */
- public boolean doesUserHaveRole(Principal principal, Set<Principal> rolePrincipals)
- {
- boolean hasRole = false;
- RoleGroup roles = this.getCurrentRoles(principal);
- if( trace )
- log.trace("doesUserHaveRole(Set), roles: "+roles);
- if(roles != null)
- {
- Iterator<Principal> iter = rolePrincipals.iterator();
- while( hasRole == false && iter.hasNext() )
- {
- Principal role = iter.next();
- hasRole = doesRoleGroupHaveRole(role, roles);
- if( trace )
- log.trace("hasRole("+role+")="+hasRole);
- }
- if( trace )
- log.trace("hasRole="+hasRole);
- }
- return hasRole;
- }
-
- /** Does the current Subject have a role(a Principal) that equates to one
- of the role names.
-
- @see #doesUserHaveRole(Principal, Set)
-
- @param principal - ignored. The current authenticated Subject determines
- the active user and assigned user roles.
- @param role - the application domain role that the principal is to be
- validated against.
- @return true if the active principal has the role, false otherwise.
- */
- public boolean doesUserHaveRole(Principal principal, Principal role)
- {
- boolean hasRole = false;
- RoleGroup roles = this.getCurrentRoles(principal);
- hasRole = doesRoleGroupHaveRole(role, roles);
- return hasRole;
- }
-
- /** Return the set of domain roles the current active Subject 'Roles' group
- found in the subject Principals set.
-
- @param principal - ignored. The current authenticated Subject determines
- the active user and assigned user roles.
- @return The Set<Principal> for the application domain roles that the
- principal has been assigned.
- */
- public Set<Principal> getUserRoles(Principal principal)
- {
- RoleGroup userRoles = getCurrentRoles(principal);
- return this.getRolesAsSet(userRoles);
- }
-
-
- /** Check that the indicated application domain role is a member of the
- user's assigned roles. This handles the special AnybodyPrincipal and
- NobodyPrincipal independent of the Group implementation.
-
- @param role , the application domain role required for access
- @param userRoles , the set of roles assigned to the user
- @return true if role is in userRoles or an AnybodyPrincipal instance, false
- if role is a NobodyPrincipal or no a member of userRoles
- */
- protected boolean doesRoleGroupHaveRole(Principal role, RoleGroup userRoles)
- {
- // First check that role is not a NobodyPrincipal
- if (role instanceof NobodyPrincipal)
- return false;
-
- // Check for inclusion in the user's role set
- boolean isMember = userRoles.containsRole(new SimpleRole(role.getName()));
- if (isMember == false)
- { // Check the AnybodyPrincipal special cases
- isMember = (role instanceof AnybodyPrincipal);
- }
-
- return isMember;
- }
-
- @Override
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- buf.append("[AuthorizationManager:class=").append(getClass().getName());
- buf.append(":").append(this.securityDomain).append(":");
- buf.append("]");
- return buf.toString();
- }
-
- //Value added methods
- /**
- * Set the AuthorizationContext
- */
- public void setAuthorizationContext(AuthorizationContext ac)
- {
- if(ac == null)
- throw new IllegalArgumentException("AuthorizationContext is null");
- lock.lock();
- try
- {
- String sc = ac.getSecurityDomain();
- if(this.securityDomain.equals(sc) == false)
- throw new IllegalArgumentException("The Security Domain "+ sc
- + " does not match with " + this.securityDomain);
- this.authorizationContext = ac;
- }
- finally
- {
- lock.unlock();
- }
- }
-
- public String getSecurityDomain()
- {
- return this.securityDomain;
- }
-
-
- /**
- * @see AuthorizationManager#getTargetRoles(Principal, Map)
- */
- public Group getTargetRoles(Principal targetPrincipal, Map<String,Object> contextMap)
- {
- throw new NotImplementedException();
- }
-
- //Private Methods
- private HashSet<Principal> getRolesAsSet(RoleGroup roles)
- {
- HashSet<Principal> userRoles = null;
- if( roles != null )
- {
- userRoles = new HashSet<Principal>();
- List<Role> rolesList = roles.getRoles();
- for(Role r: rolesList)
- {
- userRoles.add(new SimplePrincipal(r.getRoleName()));
- }
- }
- return userRoles;
- }
-
- /**
- * @see AuthorizationManager#getSubjectRoles(Subject, CallbackHandler)
- */
- public RoleGroup getSubjectRoles(Subject authenticatedSubject, CallbackHandler cbh)
- {
- if(authenticatedSubject == null)
- return null;
-
- //Ask the CBH for the SecurityContext
- SecurityContextCallback scb = new SecurityContextCallback();
- try
- {
- cbh.handle(new Callback[]{scb});
- }
- catch (Exception e)
- {
- log.trace("Exception in getSubjectRoles:",e);
- throw new RuntimeException(e);
- }
- SecurityContext sc = scb.getSecurityContext();
-
- //Handle the case of Incoming RunAs
- Principal callerPrincipal = null;
- RunAs callerRunAs = sc.getIncomingRunAs();
- if(callerRunAs != null)
- {
- callerPrincipal = new SimplePrincipal(callerRunAs.getName());
- }
-
- RoleGroup roles = this.getCurrentRoles(callerPrincipal, authenticatedSubject, sc);
- if(roles == null)
- roles = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
- return roles;
- }
-
- /*
- * Get the current role group from the security context or
- * the Subject
- * @param principal The Principal in question
- */
- private RoleGroup getCurrentRoles(Principal principal)
- {
- //Check that the caller is authenticated to the current thread
- Subject subject = SubjectActions.getActiveSubject();
-
- //Deal with the security context
- SecurityContext sc = SubjectActions.getSecurityContext();
- if(sc == null)
- {
- sc = new JBossSecurityContext(securityDomain);
- SubjectActions.setSecurityContext(sc);
- }
-
- return getCurrentRoles(principal,subject,sc);
- }
-
- private RoleGroup getCurrentRoles(Principal principal, Subject subject, SecurityContext sc)
- {
- if(subject == null)
- throw new IllegalArgumentException("Subject passed is null");
- if(sc == null)
- throw new IllegalArgumentException("Sec Ctx sc passed is null");
-
- Group subjectRoles = getGroupFromSubject(subject);
-
- boolean emptyContextRoles = false;
-
- RoleGroup userRoles = sc.getUtil().getRoles();
- //Group userRoles = (Group)sc.getData().get(ROLES_IDENTIFIER);
- if(userRoles == null || "true".equalsIgnoreCase(SubjectActions.getRefreshSecurityContextRoles()))
- emptyContextRoles = true;
- userRoles = copyGroups(userRoles, subjectRoles);
-
- /**
- * Update the roles in the SecurityContext and
- * allow mapping rules be applied only if the SC roles
- * and the subject roles are not the same
- */
- if(subjectRoles != userRoles || emptyContextRoles)
- {
- MappingManager mm = sc.getMappingManager();
- MappingContext<RoleGroup> mc = mm.getMappingContext(RoleGroup.class);
-
- RoleGroup mappedUserRoles = userRoles;
- if(mc != null && mc.hasModules())
- {
- Map<String,Object> contextMap = new HashMap<String,Object>();
- contextMap.put(SecurityConstants.ROLES_IDENTIFIER, userRoles);
- if(principal != null)
- contextMap.put(SecurityConstants.PRINCIPAL_IDENTIFIER, principal);
- //Append any deployment role->principals configuration done by the user
- contextMap.put(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP,
- SecurityRolesAssociation.getSecurityRoles());
-
- //Append the principals also
- contextMap.put(SecurityConstants.PRINCIPALS_SET_IDENTIFIER, subject.getPrincipals());
- if(trace)
- log.trace("Roles before mapping:"+ userRoles);
-
- if(userRoles == null)
- userRoles = this.getEmptyRoleGroup();
-
- mc.performMapping(contextMap, userRoles);
- mappedUserRoles = mc.getMappingResult().getMappedObject();
- if(trace)
- log.trace("Roles after mapping:"+ userRoles);
- }
- sc.getData().put(ROLES_IDENTIFIER, mappedUserRoles);
- }
-
- //Ensure that the security context has the roles
- if(sc.getUtil().getRoles() == null)
- sc.getUtil().setRoles(userRoles);
-
- //Send the final processed (mapping applied) roles
- return userRoles;
- }
-
- /**
- * Copy the principals from the second group into the first.
- * If the first group is null and the second group is not, the
- * first group will be made equal to the second group
- * @param source
- * @param toCopy
- */
- private RoleGroup copyGroups(RoleGroup source, Group toCopy)
- {
- if(toCopy == null)
- return source;
- if(source == null && toCopy != null)
- source = this.getEmptyRoleGroup();
- Enumeration<? extends Principal> en = toCopy.members();
- while(en.hasMoreElements())
- {
- source.addRole(new SimpleRole(en.nextElement().getName()));
- }
-
- return source;
- }
-
- private int internalAuthorization(final Resource resource, Subject subject,
- RoleGroup role)
- throws AuthorizationException
- {
- lock.lock();
- try
- {
- if(this.authorizationContext == null)
- this.authorizationContext = new JBossAuthorizationContext(this.securityDomain);
- return this.authorizationContext.authorize(resource, subject, role);
- }
- finally
- {
- lock.unlock();
- }
- }
-
- /**
- * Get the Subject roles by looking for a Group called 'Roles'
- * @param theSubject - the Subject to search for roles
- * @return the Group contain the subject roles if found, null otherwise
- */
- private Group getGroupFromSubject(Subject theSubject)
- {
- if(theSubject == null)
- throw new IllegalArgumentException("Subject is null");
- Set<Group> subjectGroups = theSubject.getPrincipals(Group.class);
- Iterator<Group> iter = subjectGroups.iterator();
- Group roles = null;
- while( iter.hasNext() )
- {
- Group grp = iter.next();
- String name = grp.getName();
- if( name.equals(ROLES_IDENTIFIER) )
- roles = grp;
- }
- return roles;
- }
-
- private RoleGroup getRoleGroup(Group roleGroup)
- {
- if(roleGroup == null)
- throw new IllegalArgumentException("roleGroup is null");
- SimpleRoleGroup srg = new SimpleRoleGroup(roleGroup.getName());
- Enumeration<? extends Principal> principals = roleGroup.members();
- while(principals.hasMoreElements())
- {
- srg.getRoles().add(new SimpleRole(principals.nextElement().getName()));
- }
- return srg;
- }
-
-
- private void validateResource(Resource resource)
- {
- if(resource == null)
- throw new IllegalArgumentException("resource is null");
- if(resource.getMap() == null)
- throw new IllegalArgumentException("resource has null context map");
- }
-
- private RoleGroup getEmptyRoleGroup()
- {
- return new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
- }
-}
\ No newline at end of file
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java (from rev 92162, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/JBossAuthorizationManager.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,531 @@
+/*
+ * 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.plugins;
+
+import static org.jboss.security.SecurityConstants.ROLES_IDENTIFIER;
+
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.AnybodyPrincipal;
+import org.jboss.security.AuthorizationManager;
+import org.jboss.security.NobodyPrincipal;
+import org.jboss.security.RunAs;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityRolesAssociation;
+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;
+import org.jboss.security.identity.plugins.SimpleRoleGroup;
+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;
+import org.jboss.util.NotImplementedException;
+
+//$Id$
+
+/**
+ * Authorization Manager implementation
+ * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ * @since Jan 3, 2006
+ * @version $Revision$
+ */
+public class JBossAuthorizationManager
+implements AuthorizationManager
+{
+ private final String securityDomain;
+
+ private static Logger log = Logger.getLogger(JBossAuthorizationManager.class);
+
+ protected boolean trace = log.isTraceEnabled();
+
+ private AuthorizationContext authorizationContext = null;
+
+ private ACLContext aclContext = null;
+
+ //Lock deals with synchronization of authorizationContext usage
+ private final Lock lock = new ReentrantLock();
+
+ public JBossAuthorizationManager(String securityDomainName)
+ {
+ this.securityDomain = securityDomainName;
+ }
+
+ /**
+ * @see AuthorizationManager#authorize(Resource)
+ */
+ public int authorize(Resource resource) throws AuthorizationException
+ {
+ validateResource(resource);
+ Subject subject = SubjectActions.getActiveSubject();
+ return internalAuthorization(resource,subject, null);
+ }
+
+ /**
+ * @see AuthorizationManager#authorize(Resource, Subject)
+ */
+ public int authorize(Resource resource, Subject subject)
+ throws AuthorizationException
+ {
+ return internalAuthorization(resource, subject, null);
+ }
+
+ /**
+ * @see AuthorizationManager#authorize(Resource, Subject, RoleGroup)
+ */
+ public int authorize(Resource resource, Subject subject,
+ RoleGroup role) throws AuthorizationException
+ {
+ this.validateResource(resource);
+ return internalAuthorization(resource, subject, role);
+ }
+
+ /**
+ * @see AuthorizationManager#authorize(Resource, Subject, Group)
+ */
+ public int authorize(Resource resource, Subject subject,
+ Group roleGroup) throws AuthorizationException
+ {
+ this.validateResource(resource);
+ 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
+ by the SecurityAssociation.getSubject() method and then creates a
+ SimplePrincipal for each name in roleNames. If the role is a member of the
+ Roles group, then the user has the role. This requires that the caller
+ establish the correct SecurityAssociation subject prior to calling this
+ method. In the past this was done as a side-effect of an isValid() call,
+ but this is no longer the case.
+
+ @param principal - ignored. The current authenticated Subject determines
+ the active user and assigned user roles.
+ @param rolePrincipals - a Set of Principals for the roles to check.
+
+ @see java.security.acl.Group;
+ @see Subject#getPrincipals()
+ */
+ public boolean doesUserHaveRole(Principal principal, Set<Principal> rolePrincipals)
+ {
+ boolean hasRole = false;
+ RoleGroup roles = this.getCurrentRoles(principal);
+ if( trace )
+ log.trace("doesUserHaveRole(Set), roles: "+roles);
+ if(roles != null)
+ {
+ Iterator<Principal> iter = rolePrincipals.iterator();
+ while( hasRole == false && iter.hasNext() )
+ {
+ Principal role = iter.next();
+ hasRole = doesRoleGroupHaveRole(role, roles);
+ if( trace )
+ log.trace("hasRole("+role+")="+hasRole);
+ }
+ if( trace )
+ log.trace("hasRole="+hasRole);
+ }
+ return hasRole;
+ }
+
+ /** Does the current Subject have a role(a Principal) that equates to one
+ of the role names.
+
+ @see #doesUserHaveRole(Principal, Set)
+
+ @param principal - ignored. The current authenticated Subject determines
+ the active user and assigned user roles.
+ @param role - the application domain role that the principal is to be
+ validated against.
+ @return true if the active principal has the role, false otherwise.
+ */
+ public boolean doesUserHaveRole(Principal principal, Principal role)
+ {
+ boolean hasRole = false;
+ RoleGroup roles = this.getCurrentRoles(principal);
+ hasRole = doesRoleGroupHaveRole(role, roles);
+ return hasRole;
+ }
+
+ /** Return the set of domain roles the current active Subject 'Roles' group
+ found in the subject Principals set.
+
+ @param principal - ignored. The current authenticated Subject determines
+ the active user and assigned user roles.
+ @return The Set<Principal> for the application domain roles that the
+ principal has been assigned.
+ */
+ public Set<Principal> getUserRoles(Principal principal)
+ {
+ RoleGroup userRoles = getCurrentRoles(principal);
+ return this.getRolesAsSet(userRoles);
+ }
+
+
+ /** Check that the indicated application domain role is a member of the
+ user's assigned roles. This handles the special AnybodyPrincipal and
+ NobodyPrincipal independent of the Group implementation.
+
+ @param role , the application domain role required for access
+ @param userRoles , the set of roles assigned to the user
+ @return true if role is in userRoles or an AnybodyPrincipal instance, false
+ if role is a NobodyPrincipal or no a member of userRoles
+ */
+ protected boolean doesRoleGroupHaveRole(Principal role, RoleGroup userRoles)
+ {
+ // First check that role is not a NobodyPrincipal
+ if (role instanceof NobodyPrincipal)
+ return false;
+
+ // Check for inclusion in the user's role set
+ boolean isMember = userRoles.containsRole(new SimpleRole(role.getName()));
+ if (isMember == false)
+ { // Check the AnybodyPrincipal special cases
+ isMember = (role instanceof AnybodyPrincipal);
+ }
+
+ return isMember;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append("[AuthorizationManager:class=").append(getClass().getName());
+ buf.append(":").append(this.securityDomain).append(":");
+ buf.append("]");
+ return buf.toString();
+ }
+
+ //Value added methods
+ /**
+ * Set the AuthorizationContext
+ */
+ public void setAuthorizationContext(AuthorizationContext ac)
+ {
+ if(ac == null)
+ throw new IllegalArgumentException("AuthorizationContext is null");
+ lock.lock();
+ try
+ {
+ String sc = ac.getSecurityDomain();
+ if(this.securityDomain.equals(sc) == false)
+ throw new IllegalArgumentException("The Security Domain "+ sc
+ + " does not match with " + this.securityDomain);
+ this.authorizationContext = ac;
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+
+ public String getSecurityDomain()
+ {
+ return this.securityDomain;
+ }
+
+
+ /**
+ * @see AuthorizationManager#getTargetRoles(Principal, Map)
+ */
+ public Group getTargetRoles(Principal targetPrincipal, Map<String,Object> contextMap)
+ {
+ throw new NotImplementedException();
+ }
+
+ //Private Methods
+ private HashSet<Principal> getRolesAsSet(RoleGroup roles)
+ {
+ HashSet<Principal> userRoles = null;
+ if( roles != null )
+ {
+ userRoles = new HashSet<Principal>();
+ List<Role> rolesList = roles.getRoles();
+ for(Role r: rolesList)
+ {
+ userRoles.add(new SimplePrincipal(r.getRoleName()));
+ }
+ }
+ return userRoles;
+ }
+
+ /**
+ * @see AuthorizationManager#getSubjectRoles(Subject, CallbackHandler)
+ */
+ public RoleGroup getSubjectRoles(Subject authenticatedSubject, CallbackHandler cbh)
+ {
+ if(authenticatedSubject == null)
+ return null;
+
+ //Ask the CBH for the SecurityContext
+ SecurityContextCallback scb = new SecurityContextCallback();
+ try
+ {
+ cbh.handle(new Callback[]{scb});
+ }
+ catch (Exception e)
+ {
+ log.trace("Exception in getSubjectRoles:",e);
+ throw new RuntimeException(e);
+ }
+ SecurityContext sc = scb.getSecurityContext();
+
+ //Handle the case of Incoming RunAs
+ Principal callerPrincipal = null;
+ RunAs callerRunAs = sc.getIncomingRunAs();
+ if(callerRunAs != null)
+ {
+ callerPrincipal = new SimplePrincipal(callerRunAs.getName());
+ }
+
+ RoleGroup roles = this.getCurrentRoles(callerPrincipal, authenticatedSubject, sc);
+ if(roles == null)
+ roles = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
+ return roles;
+ }
+
+ /*
+ * Get the current role group from the security context or
+ * the Subject
+ * @param principal The Principal in question
+ */
+ private RoleGroup getCurrentRoles(Principal principal)
+ {
+ //Check that the caller is authenticated to the current thread
+ Subject subject = SubjectActions.getActiveSubject();
+
+ //Deal with the security context
+ SecurityContext sc = SubjectActions.getSecurityContext();
+ if(sc == null)
+ {
+ sc = new JBossSecurityContext(securityDomain);
+ SubjectActions.setSecurityContext(sc);
+ }
+
+ return getCurrentRoles(principal,subject,sc);
+ }
+
+ private RoleGroup getCurrentRoles(Principal principal, Subject subject, SecurityContext sc)
+ {
+ if(subject == null)
+ throw new IllegalArgumentException("Subject passed is null");
+ if(sc == null)
+ throw new IllegalArgumentException("Sec Ctx sc passed is null");
+
+ Group subjectRoles = getGroupFromSubject(subject);
+
+ boolean emptyContextRoles = false;
+
+ RoleGroup userRoles = sc.getUtil().getRoles();
+ //Group userRoles = (Group)sc.getData().get(ROLES_IDENTIFIER);
+ if(userRoles == null || "true".equalsIgnoreCase(SubjectActions.getRefreshSecurityContextRoles()))
+ emptyContextRoles = true;
+ userRoles = copyGroups(userRoles, subjectRoles);
+
+ /**
+ * Update the roles in the SecurityContext and
+ * allow mapping rules be applied only if the SC roles
+ * and the subject roles are not the same
+ */
+ if(subjectRoles != userRoles || emptyContextRoles)
+ {
+ MappingManager mm = sc.getMappingManager();
+ MappingContext<RoleGroup> mc = mm.getMappingContext(MappingType.ROLE.name());
+
+ RoleGroup mappedUserRoles = userRoles;
+ if(mc != null && mc.hasModules())
+ {
+ Map<String,Object> contextMap = new HashMap<String,Object>();
+ contextMap.put(SecurityConstants.ROLES_IDENTIFIER, userRoles);
+ if(principal != null)
+ contextMap.put(SecurityConstants.PRINCIPAL_IDENTIFIER, principal);
+ //Append any deployment role->principals configuration done by the user
+ contextMap.put(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP,
+ SecurityRolesAssociation.getSecurityRoles());
+
+ //Append the principals also
+ contextMap.put(SecurityConstants.PRINCIPALS_SET_IDENTIFIER, subject.getPrincipals());
+ if(trace)
+ log.trace("Roles before mapping:"+ userRoles);
+
+ if(userRoles == null)
+ userRoles = this.getEmptyRoleGroup();
+
+ mc.performMapping(contextMap, userRoles);
+ mappedUserRoles = mc.getMappingResult().getMappedObject();
+ if(trace)
+ log.trace("Roles after mapping:"+ userRoles);
+ }
+ sc.getData().put(ROLES_IDENTIFIER, mappedUserRoles);
+ }
+
+ //Ensure that the security context has the roles
+ if(sc.getUtil().getRoles() == null)
+ sc.getUtil().setRoles(userRoles);
+
+ //Send the final processed (mapping applied) roles
+ return userRoles;
+ }
+
+ /**
+ * Copy the principals from the second group into the first.
+ * If the first group is null and the second group is not, the
+ * first group will be made equal to the second group
+ * @param source
+ * @param toCopy
+ */
+ private RoleGroup copyGroups(RoleGroup source, Group toCopy)
+ {
+ if(toCopy == null)
+ return source;
+ if(source == null && toCopy != null)
+ source = this.getEmptyRoleGroup();
+ Enumeration<? extends Principal> en = toCopy.members();
+ while(en.hasMoreElements())
+ {
+ source.addRole(new SimpleRole(en.nextElement().getName()));
+ }
+
+ return source;
+ }
+
+ private int internalAuthorization(final Resource resource, Subject subject,
+ RoleGroup role)
+ throws AuthorizationException
+ {
+ lock.lock();
+ try
+ {
+ if(this.authorizationContext == null)
+ this.authorizationContext = new JBossAuthorizationContext(this.securityDomain);
+ return this.authorizationContext.authorize(resource, subject, role);
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Get the Subject roles by looking for a Group called 'Roles'
+ * @param theSubject - the Subject to search for roles
+ * @return the Group contain the subject roles if found, null otherwise
+ */
+ private Group getGroupFromSubject(Subject theSubject)
+ {
+ if(theSubject == null)
+ throw new IllegalArgumentException("Subject is null");
+ Set<Group> subjectGroups = theSubject.getPrincipals(Group.class);
+ Iterator<Group> iter = subjectGroups.iterator();
+ Group roles = null;
+ while( iter.hasNext() )
+ {
+ Group grp = iter.next();
+ String name = grp.getName();
+ if( name.equals(ROLES_IDENTIFIER) )
+ roles = grp;
+ }
+ return roles;
+ }
+
+ private RoleGroup getRoleGroup(Group roleGroup)
+ {
+ if(roleGroup == null)
+ throw new IllegalArgumentException("roleGroup is null");
+ SimpleRoleGroup srg = new SimpleRoleGroup(roleGroup.getName());
+ Enumeration<? extends Principal> principals = roleGroup.members();
+ while(principals.hasMoreElements())
+ {
+ srg.getRoles().add(new SimpleRole(principals.nextElement().getName()));
+ }
+ return srg;
+ }
+
+
+ private void validateResource(Resource resource)
+ {
+ if(resource == null)
+ throw new IllegalArgumentException("resource is null");
+ if(resource.getMap() == null)
+ throw new IllegalArgumentException("resource has null context map");
+ }
+
+ private RoleGroup getEmptyRoleGroup()
+ {
+ return new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
+ }
+}
\ No newline at end of file
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,121 +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.plugins.mapping;
-
-import java.util.ArrayList;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.SecurityConstants;
-import org.jboss.security.SecurityContext;
-import org.jboss.security.config.ApplicationPolicy;
-import org.jboss.security.config.MappingInfo;
-import org.jboss.security.config.SecurityConfiguration;
-import org.jboss.security.mapping.MappingContext;
-import org.jboss.security.mapping.MappingManager;
-import org.jboss.security.mapping.MappingProvider;
-import org.jboss.security.mapping.config.MappingModuleEntry;
-import org.jboss.security.plugins.JBossSecurityContext;
-
-
-/**
- * JBoss implementation of Mapping Manager
- * @author Anil.Saldhana at redhat.com
- * @since Mar 9, 2007
- * @version $Revision$
- */
-public class JBossMappingManager implements MappingManager
-{
- protected static final Logger log = Logger.getLogger(JBossSecurityContext.class);
- protected boolean trace = log.isTraceEnabled();
-
- private String securityDomain;
-
- public JBossMappingManager(String domain)
- {
- this.securityDomain = domain;
- }
-
- /**
- * @see SecurityContext#getMappingContext(String)
- */
- public <T> MappingContext<T> getMappingContext(Class<T> mappingType)
- {
- //Apply Mapping Logic
- ApplicationPolicy aPolicy = SecurityConfiguration.getApplicationPolicy(securityDomain);
-
- if(aPolicy == null)
- {
- String defaultDomain = SecurityConstants.DEFAULT_APPLICATION_POLICY;
- if(trace)
- log.trace("Application Policy not found for domain=" + securityDomain +
- ".Mapping framework will use the default domain:" + defaultDomain);
- aPolicy = SecurityConfiguration.getApplicationPolicy(defaultDomain);
- }
- if(aPolicy == null )
- throw new IllegalStateException("Application Policy is null for the security domain:"
- + securityDomain);
-
- MappingContext<T> mc = null;
- MappingInfo rmi = aPolicy.getMappingInfo(mappingType);
-
- if(rmi != null)
- {
- MappingModuleEntry[] mpe = rmi.getMappingModuleEntry();
- ArrayList<MappingProvider<T>> al = new ArrayList<MappingProvider<T>>();
-
- for(int i = 0 ; i < mpe.length; i++)
- {
- MappingProvider<T> mp = getMappingProvider(mpe[i]);
- if(mp != null)
- al.add(mp);
- }
- mc = new MappingContext<T>(al);
- }
-
- return mc;
- }
-
- public String getSecurityDomain()
- {
- return this.securityDomain;
- }
-
- @SuppressWarnings("unchecked")
- private <T> MappingProvider<T> getMappingProvider(MappingModuleEntry mme)
- {
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- MappingProvider<T> mp = null;
- try
- {
- String fqn = mme.getMappingModuleName();
- Class<?> cl = SecurityActions.loadClass(fqn,tcl);
- mp = (MappingProvider<T>) cl.newInstance();
- mp.init(mme.getOptions());
- }
- catch(Exception e)
- {
- if(trace)
- log.trace("Error in getting Mapping Provider",e);
- }
- return mp;
- }
-}
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/main/java/org/jboss/security/plugins/mapping/JBossMappingManager.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,153 @@
+/*
+ * 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.plugins.mapping;
+
+import java.util.ArrayList;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.config.ApplicationPolicy;
+import org.jboss.security.config.MappingInfo;
+import org.jboss.security.config.SecurityConfiguration;
+import org.jboss.security.mapping.MappingContext;
+import org.jboss.security.mapping.MappingManager;
+import org.jboss.security.mapping.MappingProvider;
+import org.jboss.security.mapping.config.MappingModuleEntry;
+import org.jboss.security.plugins.JBossSecurityContext;
+
+
+/**
+ * JBoss implementation of Mapping Manager
+ * @author Anil.Saldhana at redhat.com
+ * @since Mar 9, 2007
+ * @version $Revision$
+ */
+public class JBossMappingManager implements MappingManager
+{
+ protected static final Logger log = Logger.getLogger(JBossSecurityContext.class);
+ protected boolean trace = log.isTraceEnabled();
+
+ private String securityDomain;
+
+ public JBossMappingManager(String domain)
+ {
+ this.securityDomain = domain;
+ }
+
+
+ public <T> MappingContext<T> getMappingContext(String mappingType)
+ {
+ //Apply Mapping Logic
+ ApplicationPolicy aPolicy = SecurityConfiguration.getApplicationPolicy(securityDomain);
+
+ if(aPolicy == null)
+ {
+ String defaultDomain = SecurityConstants.DEFAULT_APPLICATION_POLICY;
+ if(trace)
+ log.trace("Application Policy not found for domain=" + securityDomain +
+ ".Mapping framework will use the default domain:" + defaultDomain);
+ aPolicy = SecurityConfiguration.getApplicationPolicy(defaultDomain);
+ }
+ if(aPolicy == null )
+ throw new IllegalStateException("Application Policy is null for the security domain:"
+ + securityDomain);
+
+ MappingContext<T> mc = null;
+ MappingInfo rmi = aPolicy.getMappingInfo(mappingType);
+
+ if( rmi != null)
+ mc = generateMappingContext(mc, rmi);
+
+ return mc;
+ }
+
+
+ /**
+ * @see SecurityContext#getMappingContext(String)
+ */
+ @SuppressWarnings("deprecation")
+ public <T> MappingContext<T> getMappingContext(Class<T> mappingType)
+ {
+ //Apply Mapping Logic
+ ApplicationPolicy aPolicy = SecurityConfiguration.getApplicationPolicy(securityDomain);
+
+ if(aPolicy == null)
+ {
+ String defaultDomain = SecurityConstants.DEFAULT_APPLICATION_POLICY;
+ if(trace)
+ log.trace("Application Policy not found for domain=" + securityDomain +
+ ".Mapping framework will use the default domain:" + defaultDomain);
+ aPolicy = SecurityConfiguration.getApplicationPolicy(defaultDomain);
+ }
+ if(aPolicy == null )
+ throw new IllegalStateException("Application Policy is null for the security domain:"
+ + securityDomain);
+
+ MappingContext<T> mc = null;
+ MappingInfo rmi = aPolicy.getMappingInfo(mappingType);
+ if( rmi != null)
+ mc = generateMappingContext(mc, rmi);
+
+ return mc;
+ }
+
+
+ private <T> MappingContext<T> generateMappingContext(MappingContext<T> mc, MappingInfo rmi)
+ {
+ MappingModuleEntry[] mpe = rmi.getMappingModuleEntry();
+ ArrayList<MappingProvider<T>> al = new ArrayList<MappingProvider<T>>();
+
+ for(int i = 0 ; i < mpe.length; i++)
+ {
+ MappingProvider<T> mp = getMappingProvider(mpe[i]);
+ if(mp != null)
+ al.add(mp);
+ }
+ return new MappingContext<T>(al);
+ }
+
+ public String getSecurityDomain()
+ {
+ return this.securityDomain;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> MappingProvider<T> getMappingProvider(MappingModuleEntry mme)
+ {
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ MappingProvider<T> mp = null;
+ try
+ {
+ String fqn = mme.getMappingModuleName();
+ Class<?> cl = SecurityActions.loadClass(fqn,tcl);
+ mp = (MappingProvider<T>) cl.newInstance();
+ mp.init(mme.getOptions());
+ }
+ catch(Exception e)
+ {
+ if(trace)
+ log.trace("Error in getting Mapping Provider",e);
+ }
+ return mp;
+ }
+}
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/ClientLoginModuleUnitTestCase.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/authentication/jaas/ClientLoginModuleUnitTestCase.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/ClientLoginModuleUnitTestCase.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,448 +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.test.authentication.jaas;
-
-import java.lang.reflect.Method;
-import java.security.Principal;
-import java.util.Arrays;
-import java.util.HashMap;
-
-import javax.security.auth.Subject;
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.security.auth.login.Configuration;
-import javax.security.auth.login.LoginContext;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.jboss.security.SecurityAssociation;
-import org.jboss.security.SecurityContextAssociation;
-import org.jboss.security.SimplePrincipal;
-import org.jboss.security.auth.callback.UsernamePasswordHandler;
-
-/**
- ClientLoginModuleUnitTestCase/SecurityAssociation interaction tests
-
- @author Scott.Stark at jboss.org
- @version $Revision: 68075 $
-*/
-public class ClientLoginModuleUnitTestCase
- extends TestCase
-{
- static TestConfig jaasConfig = new TestConfig();
-
- static class TestConfig extends Configuration
- {
- public void refresh()
- {
- }
-
- public AppConfigurationEntry[] getAppConfigurationEntry(String name)
- {
- AppConfigurationEntry[] entry = null;
- try
- {
- Class<?>[] parameterTypes = {};
- Method m = getClass().getDeclaredMethod(name, parameterTypes);
- Object[] args = {};
- entry = (AppConfigurationEntry[]) m.invoke(this, args);
- }
- catch(Exception e)
- {
- }
- return entry;
- }
- AppConfigurationEntry[] testSingleThreaded()
- {
- String name = "org.jboss.security.ClientLoginModule";
- HashMap<String,String> options = new HashMap<String,String>();
- options.put("multi-threaded", "false");
- AppConfigurationEntry ace = new AppConfigurationEntry(name,
- AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
- AppConfigurationEntry[] entry = {ace};
- return entry;
- }
- AppConfigurationEntry[] testSingleThreadedRestoreIdentity()
- {
- String name = "org.jboss.security.ClientLoginModule";
- HashMap<String,String> options = new HashMap<String,String>();
- options.put("multi-threaded", "false");
- options.put("restore-login-identity", "true");
- AppConfigurationEntry ace = new AppConfigurationEntry(name,
- AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
- AppConfigurationEntry[] entry = {ace};
- return entry;
- }
- AppConfigurationEntry[] testSingleThreadedRestoreStack()
- {
- String name = "org.jboss.security.ClientLoginModule";
- HashMap<String,String> options = new HashMap<String,String>();
- options.put("multi-threaded", "false");
- options.put("restore-login-identity", "true");
- AppConfigurationEntry ace = new AppConfigurationEntry(name,
- AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
- AppConfigurationEntry[] entry = {ace};
- return entry;
- }
- AppConfigurationEntry[] testMultiThreaded()
- {
- String name = "org.jboss.security.ClientLoginModule";
- HashMap<String,String> options = new HashMap<String,String>();
- options.put("multi-threaded", "true");
- AppConfigurationEntry ace = new AppConfigurationEntry(name,
- AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
- AppConfigurationEntry[] entry = {ace};
- return entry;
- }
- AppConfigurationEntry[] testMultiThreadedRestoreIdentity()
- {
- String name = "org.jboss.security.ClientLoginModule";
- HashMap<String,String> options = new HashMap<String,String>();
- options.put("multi-threaded", "true");
- options.put("restore-login-identity", "true");
- AppConfigurationEntry ace = new AppConfigurationEntry(name,
- AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
- AppConfigurationEntry[] entry = {ace};
- return entry;
- }
- AppConfigurationEntry[] testMultiThreadedRestoreStack()
- {
- String name = "org.jboss.security.ClientLoginModule";
- HashMap<String,String> options = new HashMap<String,String>();
- options.put("multi-threaded", "true");
- options.put("restore-login-identity", "true");
- AppConfigurationEntry ace = new AppConfigurationEntry(name,
- AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
- AppConfigurationEntry[] entry = {ace};
- return entry;
- }
-
- }
-
- public static Test suite() throws Exception
- {
- TestSuite suite = new TestSuite();
- suite.addTest(new ClientLoginModuleUnitTestCase("testSingleThreaded"));
- suite.addTest(new ClientLoginModuleUnitTestCase("testSingleThreadedRestoreIdentity"));
- suite.addTest(new ClientLoginModuleUnitTestCase("testSingleThreadedRestoreStack"));
- suite.addTest(new ClientLoginModuleUnitTestCase("testMultiThreaded"));
- suite.addTest(new ClientLoginModuleUnitTestCase("testMultiThreadedRestoreIdentity"));
- suite.addTest(new ClientLoginModuleUnitTestCase("testMultiThreadedRestoreStack"));
- return suite;
- }
-
- public ClientLoginModuleUnitTestCase(String name)
- {
- super(name);
- }
-
- protected void setUp() throws Exception
- {
- Configuration.setConfiguration(jaasConfig);
- //Clear SecurityAssociation
- SecurityAssociation.clear();
- }
- protected void tearDown()
- {
- }
-
- public void testSingleThreaded() throws Exception
- {
- System.out.println("+++ testSingleThreaded");
- UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke",
- "theduke");
- LoginContext lc = new LoginContext("testSingleThreaded", handler);
- lc.login();
- Subject subject = lc.getSubject();
- System.out.println("LC.Subject: "+subject);
- Principal theduke = new SimplePrincipal("jduke");
- assertTrue("Principals contains theduke", subject.getPrincipals().contains(theduke));
- Principal saPrincipal = SecurityAssociation.getPrincipal();
- assertTrue("SecurityAssociation.getPrincipal == theduke", saPrincipal.equals(theduke));
- char[] password = (char[]) SecurityAssociation.getCredential();
- assertTrue("password == theduke",
- Arrays.equals(password, "theduke".toCharArray()));
-
- assertTrue("Client side association?", SecurityContextAssociation.isClient());
- }
-
- public void testSingleThreadedRestoreIdentity() throws Exception
- {
- System.out.println("+++ testSingleThreadedRestoreIdentity");
-
- Principal jduke1 = new SimplePrincipal("jduke1");
- SecurityAssociation.setPrincipal(jduke1);
- SecurityAssociation.setCredential("theduke1");
-
- UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke2",
- "theduke2");
- LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
- lc.login();
- Subject subject = lc.getSubject();
- System.out.println("LC.Subject: "+subject);
-
- Principal jduke2 = new SimplePrincipal("jduke2");
- assertTrue("Principals contains jduke2", subject.getPrincipals().contains(jduke2));
- Principal saPrincipal = SecurityAssociation.getPrincipal();
- assertTrue("SecurityAssociation.getPrincipal == jduke2", saPrincipal.equals(jduke2));
- char[] password = (char[]) SecurityAssociation.getCredential();
- assertTrue("password == theduke2",
- Arrays.equals(password, "theduke2".toCharArray()));
-
- lc.logout();
- // Validate restored state
- saPrincipal = SecurityAssociation.getPrincipal();
- assertTrue("SecurityAssociation.getPrincipal == jduke1", saPrincipal.equals(jduke1));
- String theduke1 = (String) SecurityAssociation.getCredential();
- assertTrue("password == theduke1", theduke1.equals("theduke1"));
-
- }
-
- @SuppressWarnings("deprecation")
- public void testSingleThreadedRestoreStack() throws Exception
- {
- System.out.println("+++ testSingleThreadedRestoreStack");
-
- Principal jduke1 = new SimplePrincipal("jduke1");
- Subject subject1 = new Subject();
- SecurityAssociation.pushSubjectContext(subject1, jduke1, "theduke1");
-
- Principal jduke2 = new SimplePrincipal("jduke2");
- Subject subject2 = new Subject();
- SecurityAssociation.pushSubjectContext(subject2, jduke2, "theduke2");
-
- UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke3",
- "theduke3");
- LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
- lc.login();
- Subject subject = lc.getSubject();
- System.out.println("LC.Subject: "+subject);
-
- Principal jduke3 = new SimplePrincipal("jduke3");
- assertTrue("Principals contains jduke3", subject.getPrincipals().contains(jduke3));
- Principal saPrincipal = SecurityAssociation.getPrincipal();
- assertTrue("SecurityAssociation.getPrincipal == jduke3", saPrincipal.equals(jduke3));
- char[] password = (char[]) SecurityAssociation.getCredential();
- assertTrue("password == theduke3",
- Arrays.equals(password, "theduke3".toCharArray()));
- SecurityAssociation.SubjectContext sc3 = SecurityAssociation.peekSubjectContext();
- System.out.println(sc3);
- assertTrue("SecurityAssociation.peekSubjectContext == jduke3", sc3.getPrincipal().equals(jduke3));
- char[] theduke3 = (char[]) sc3.getCredential();
- assertTrue("password == theduke3",
- Arrays.equals(theduke3, "theduke3".toCharArray()));
-
- lc.logout();
-
- // Validate restored state
- SecurityAssociation.SubjectContext sc2 = SecurityAssociation.peekSubjectContext();
- System.out.println(sc2);
- assertTrue("SecurityAssociation.peekSubjectContext == jduke2", sc2.getPrincipal().equals(jduke2));
- String theduke2 = (String) sc2.getCredential();
- assertTrue("password == theduke2", theduke2.equals("theduke2"));
-
- SecurityAssociation.popSubjectContext();
- SecurityAssociation.SubjectContext sc1 = SecurityAssociation.peekSubjectContext();
- System.out.println(sc1);
- assertTrue("SecurityAssociation.peekSubjectContext == jduke1", sc1.getPrincipal().equals(jduke1));
- String theduke1 = (String) sc1.getCredential();
- assertTrue("password == theduke1", theduke1.equals("theduke1"));
- }
-
- public void testMultiThreaded() throws Exception
- {
- TestMultiThreaded r0 = new TestMultiThreaded();
- Thread t0 = new Thread(r0, "testMultiThreaded#0");
- t0.start();
- TestMultiThreaded r1 = new TestMultiThreaded();
- Thread t1 = new Thread(r1, "testMultiThreaded#1");
- t1.start();
-
- t0.join();
- assertTrue(r0.failure == null);
- t1.join();
- assertTrue(r1.failure == null);
- }
- static class TestMultiThreaded implements Runnable
- {
- Exception failure;
- public void run()
- {
- try
- {
- System.out.println("+++ testMultiThreadedRunnable");
- UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke",
- "theduke");
- LoginContext lc = new LoginContext("testSingleThreaded", handler);
- lc.login();
- Subject subject = lc.getSubject();
- System.out.println("LC.Subject: "+subject);
- Principal theduke = new SimplePrincipal("jduke");
- assertTrue("Principals contains theduke", subject.getPrincipals().contains(theduke));
- Principal saPrincipal = SecurityAssociation.getPrincipal();
- assertTrue("SecurityAssociation.getPrincipal == theduke", saPrincipal.equals(theduke));
- char[] password = (char[]) SecurityAssociation.getCredential();
- assertTrue("password == theduke",
- Arrays.equals(password, "theduke".toCharArray()));
- }
- catch(Exception e)
- {
- failure = e;
- }
- }
- }
-
- public void testMultiThreadedRestoreIdentity() throws Exception
- {
- TestMultiThreadedRestoreIdentity r0 = new TestMultiThreadedRestoreIdentity();
- Thread t0 = new Thread(r0, "testMultiThreadedRestoreIdentity#0");
- t0.start();
- TestMultiThreadedRestoreIdentity r1 = new TestMultiThreadedRestoreIdentity();
- Thread t1 = new Thread(r1, "testMultiThreadedRestoreIdentity#1");
- t1.start();
-
- t0.join();
- assertTrue(r0.failure == null);
- t1.join();
- assertTrue(r1.failure == null);
- }
- static class TestMultiThreadedRestoreIdentity implements Runnable
- {
- Exception failure;
- public void run()
- {
- try
- {
- System.out.println("+++ testMultiThreadedRestoreIdentity");
-
- Principal jduke1 = new SimplePrincipal("jduke1");
- SecurityAssociation.setPrincipal(jduke1);
- SecurityAssociation.setCredential("theduke1");
-
- UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke2",
- "theduke2");
- LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
- lc.login();
- Subject subject = lc.getSubject();
- System.out.println("LC.Subject: "+subject);
-
- Principal jduke2 = new SimplePrincipal("jduke2");
- assertTrue("Principals contains jduke2", subject.getPrincipals().contains(jduke2));
- Principal saPrincipal = SecurityAssociation.getPrincipal();
- assertTrue("SecurityAssociation.getPrincipal == jduke2", saPrincipal.equals(jduke2));
- char[] password = (char[]) SecurityAssociation.getCredential();
- assertTrue("password == theduke2",
- Arrays.equals(password, "theduke2".toCharArray()));
-
- lc.logout();
- // Validate restored state
- saPrincipal = SecurityAssociation.getPrincipal();
- assertTrue("SecurityAssociation.getPrincipal == jduke1", saPrincipal.equals(jduke1));
- String theduke1 = (String) SecurityAssociation.getCredential();
- assertTrue("password == theduke1", theduke1.equals("theduke1"));
-
- }
- catch(Exception e)
- {
- failure = e;
- }
- }
- }
-
- public void testMultiThreadedRestoreStack() throws Exception
- {
- TestMultiThreadedRestoreStack r0 = new TestMultiThreadedRestoreStack();
- Thread t0 = new Thread(r0, "testMultiThreadedRestoreIdentity#0");
- t0.start();
- TestMultiThreadedRestoreStack r1 = new TestMultiThreadedRestoreStack();
- Thread t1 = new Thread(r1, "testMultiThreadedRestoreIdentity#1");
- t1.start();
-
- t0.join();
- assertTrue(r0.failure == null);
- t1.join();
- assertTrue(r1.failure == null);
- }
- static class TestMultiThreadedRestoreStack implements Runnable
- {
- Exception failure;
- @SuppressWarnings("deprecation")
- public void run()
- {
- try
- {
- System.out.println("+++ testMultThreadedRestoreStack");
-
- Principal jduke1 = new SimplePrincipal("jduke1");
- Subject subject1 = new Subject();
- SecurityAssociation.pushSubjectContext(subject1, jduke1, "theduke1");
-
- Principal jduke2 = new SimplePrincipal("jduke2");
- Subject subject2 = new Subject();
- SecurityAssociation.pushSubjectContext(subject2, jduke2, "theduke2");
-
- UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke3",
- "theduke3");
- LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
- lc.login();
- Subject subject = lc.getSubject();
- System.out.println("LC.Subject: "+subject);
-
- Principal jduke3 = new SimplePrincipal("jduke3");
- assertTrue("Principals contains jduke3", subject.getPrincipals().contains(jduke3));
- Principal saPrincipal = SecurityAssociation.getPrincipal();
- assertTrue("SecurityAssociation.getPrincipal == jduke3", saPrincipal.equals(jduke3));
- char[] password = (char[]) SecurityAssociation.getCredential();
- assertTrue("password == theduke3",
- Arrays.equals(password, "theduke3".toCharArray()));
- SecurityAssociation.SubjectContext sc3 = SecurityAssociation.peekSubjectContext();
- System.out.println(sc3);
- assertTrue("SecurityAssociation.peekSubjectContext == jduke3", sc3.getPrincipal().equals(jduke3));
- char[] theduke3 = (char[]) sc3.getCredential();
- assertTrue("password == theduke3",
- Arrays.equals(theduke3, "theduke3".toCharArray()));
-
- lc.logout();
-
- // Validate restored state
- SecurityAssociation.SubjectContext sc2 = SecurityAssociation.peekSubjectContext();
- System.out.println(sc2);
- assertTrue("SecurityAssociation.peekSubjectContext == jduke2", sc2.getPrincipal().equals(jduke2));
- String theduke2 = (String) sc2.getCredential();
- assertTrue("password == theduke2", theduke2.equals("theduke2"));
-
- SecurityAssociation.popSubjectContext();
- SecurityAssociation.SubjectContext sc1 = SecurityAssociation.peekSubjectContext();
- System.out.println(sc1);
- assertTrue("SecurityAssociation.peekSubjectContext == jduke1", sc1.getPrincipal().equals(jduke1));
- String theduke1 = (String) sc1.getCredential();
- assertTrue("password == theduke1", theduke1.equals("theduke1"));
- }
- catch(Exception e)
- {
- failure = e;
- }
- }
- }
-
-}
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/ClientLoginModuleUnitTestCase.java (from rev 92165, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/authentication/jaas/ClientLoginModuleUnitTestCase.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/ClientLoginModuleUnitTestCase.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/ClientLoginModuleUnitTestCase.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,666 @@
+/*
+ * 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.test.authentication.jaas;
+
+import java.lang.reflect.Method;
+import java.security.Principal;
+import java.util.Arrays;
+import java.util.HashMap;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.security.SecurityContextFactory;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.SubjectInfo;
+import org.jboss.security.auth.callback.UsernamePasswordHandler;
+
+/**
+ ClientLoginModuleUnitTestCase/SecurityAssociation interaction tests
+
+ @author Scott.Stark at jboss.org
+ @version $Revision: 68075 $
+*/
+public class ClientLoginModuleUnitTestCase
+ extends TestCase
+{
+ static TestConfig jaasConfig = new TestConfig();
+
+ static class TestConfig extends Configuration
+ {
+ public void refresh()
+ {
+ }
+
+ public AppConfigurationEntry[] getAppConfigurationEntry(String name)
+ {
+ AppConfigurationEntry[] entry = null;
+ try
+ {
+ Class<?>[] parameterTypes = {};
+ Method m = getClass().getDeclaredMethod(name, parameterTypes);
+ Object[] args = {};
+ entry = (AppConfigurationEntry[]) m.invoke(this, args);
+ }
+ catch(Exception e)
+ {
+ }
+ return entry;
+ }
+ AppConfigurationEntry[] testSingleThreaded()
+ {
+ String name = "org.jboss.security.ClientLoginModule";
+ HashMap<String,String> options = new HashMap<String,String>();
+ options.put("multi-threaded", "false");
+ AppConfigurationEntry ace = new AppConfigurationEntry(name,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+ AppConfigurationEntry[] entry = {ace};
+ return entry;
+ }
+ AppConfigurationEntry[] testSingleThreadedRestoreIdentity()
+ {
+ String name = "org.jboss.security.ClientLoginModule";
+ HashMap<String,String> options = new HashMap<String,String>();
+ options.put("multi-threaded", "false");
+ options.put("restore-login-identity", "true");
+ AppConfigurationEntry ace = new AppConfigurationEntry(name,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+ AppConfigurationEntry[] entry = {ace};
+ return entry;
+ }
+ AppConfigurationEntry[] testSingleThreadedRestoreStack()
+ {
+ String name = "org.jboss.security.ClientLoginModule";
+ HashMap<String,String> options = new HashMap<String,String>();
+ options.put("multi-threaded", "false");
+ options.put("restore-login-identity", "true");
+ AppConfigurationEntry ace = new AppConfigurationEntry(name,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+ AppConfigurationEntry[] entry = {ace};
+ return entry;
+ }
+ AppConfigurationEntry[] testMultiThreaded()
+ {
+ String name = "org.jboss.security.ClientLoginModule";
+ HashMap<String,String> options = new HashMap<String,String>();
+ options.put("multi-threaded", "true");
+ AppConfigurationEntry ace = new AppConfigurationEntry(name,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+ AppConfigurationEntry[] entry = {ace};
+ return entry;
+ }
+ AppConfigurationEntry[] testMultiThreadedRestoreIdentity()
+ {
+ String name = "org.jboss.security.ClientLoginModule";
+ HashMap<String,String> options = new HashMap<String,String>();
+ options.put("multi-threaded", "true");
+ options.put("restore-login-identity", "true");
+ AppConfigurationEntry ace = new AppConfigurationEntry(name,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+ AppConfigurationEntry[] entry = {ace};
+ return entry;
+ }
+ AppConfigurationEntry[] testMultiThreadedRestoreStack()
+ {
+ String name = "org.jboss.security.ClientLoginModule";
+ HashMap<String,String> options = new HashMap<String,String>();
+ options.put("multi-threaded", "true");
+ options.put("restore-login-identity", "true");
+ AppConfigurationEntry ace = new AppConfigurationEntry(name,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+ AppConfigurationEntry[] entry = {ace};
+ return entry;
+ }
+
+ AppConfigurationEntry[] testAbortWithRestore()
+ {
+ String name1 = "org.jboss.security.auth.spi.SimpleServerLoginModule";
+ AppConfigurationEntry ace1 = new AppConfigurationEntry(name1,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, new HashMap<String,String>());
+
+
+ String name2 = "org.jboss.security.ClientLoginModule";
+ HashMap<String,String> options = new HashMap<String,String>();
+ options.put("multi-threaded", "true");
+ options.put("restore-login-identity", "true");
+
+
+ AppConfigurationEntry ace2 = new AppConfigurationEntry(name2,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+
+ AppConfigurationEntry[] entry = {ace1,ace2};
+ return entry;
+ }
+
+ AppConfigurationEntry[] testAbortWithNoRestore()
+ {
+ String name1 = "org.jboss.security.auth.spi.SimpleServerLoginModule";
+ AppConfigurationEntry ace1 = new AppConfigurationEntry(name1,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, new HashMap<String,String>());
+
+
+ String name2 = "org.jboss.security.ClientLoginModule";
+ HashMap<String,String> options = new HashMap<String,String>();
+ options.put("multi-threaded", "true");
+
+ AppConfigurationEntry ace2 = new AppConfigurationEntry(name2,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+
+ AppConfigurationEntry[] entry = {ace1,ace2};
+ return entry;
+ }
+
+ }
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new ClientLoginModuleUnitTestCase("testSingleThreaded"));
+ suite.addTest(new ClientLoginModuleUnitTestCase("testSingleThreadedRestoreIdentity"));
+ suite.addTest(new ClientLoginModuleUnitTestCase("testSingleThreadedRestoreStack"));
+ suite.addTest(new ClientLoginModuleUnitTestCase("testMultiThreaded"));
+ suite.addTest(new ClientLoginModuleUnitTestCase("testMultiThreadedRestoreIdentity"));
+ suite.addTest(new ClientLoginModuleUnitTestCase("testMultiThreadedRestoreStack"));
+ suite.addTest(new ClientLoginModuleUnitTestCase("testAbortWithRestore"));
+ suite.addTest(new ClientLoginModuleUnitTestCase("testAbortWithNoRestore"));
+ return suite;
+ }
+
+ public ClientLoginModuleUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ Configuration.setConfiguration(jaasConfig);
+ //Clear SecurityAssociation
+ SecurityAssociation.clear();
+ }
+ protected void tearDown()
+ {
+ }
+
+ public void testSingleThreaded() throws Exception
+ {
+ System.out.println("+++ testSingleThreaded");
+ UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke",
+ "theduke");
+ LoginContext lc = new LoginContext("testSingleThreaded", handler);
+ lc.login();
+ Subject subject = lc.getSubject();
+ System.out.println("LC.Subject: "+subject);
+ Principal theduke = new SimplePrincipal("jduke");
+ assertTrue("Principals contains theduke", subject.getPrincipals().contains(theduke));
+ Principal saPrincipal = SecurityAssociation.getPrincipal();
+ assertTrue("SecurityAssociation.getPrincipal == theduke", saPrincipal.equals(theduke));
+ char[] password = (char[]) SecurityAssociation.getCredential();
+ assertTrue("password == theduke",
+ Arrays.equals(password, "theduke".toCharArray()));
+
+ assertTrue("Client side association?", SecurityContextAssociation.isClient());
+
+ SecurityContext sc = SecurityContextAssociation.getSecurityContext();
+ assertNotNull("SecurityContext not null", sc);
+ assertEquals("jduke", sc.getUtil().getUserPrincipal().getName());
+ }
+
+ public void testSingleThreadedRestoreIdentity() throws Exception
+ {
+ System.out.println("+++ testSingleThreadedRestoreIdentity");
+
+ Principal jduke1 = new SimplePrincipal("jduke1");
+ SecurityAssociation.setPrincipal(jduke1);
+ SecurityAssociation.setCredential("theduke1");
+
+ UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke2",
+ "theduke2");
+ LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
+ lc.login();
+ Subject subject = lc.getSubject();
+ System.out.println("LC.Subject: "+subject);
+
+ Principal jduke2 = new SimplePrincipal("jduke2");
+ assertTrue("Principals contains jduke2", subject.getPrincipals().contains(jduke2));
+ Principal saPrincipal = SecurityAssociation.getPrincipal();
+ assertTrue("SecurityAssociation.getPrincipal == jduke2", saPrincipal.equals(jduke2));
+ char[] password = (char[]) SecurityAssociation.getCredential();
+ assertTrue("password == theduke2",
+ Arrays.equals(password, "theduke2".toCharArray()));
+
+ lc.logout();
+ // Validate restored state
+ saPrincipal = SecurityAssociation.getPrincipal();
+ assertTrue("SecurityAssociation.getPrincipal == jduke1", saPrincipal.equals(jduke1));
+ String theduke1 = (String) SecurityAssociation.getCredential();
+ assertTrue("password == theduke1", theduke1.equals("theduke1"));
+
+ }
+
+ @SuppressWarnings("deprecation")
+ public void testSingleThreadedRestoreStack() throws Exception
+ {
+ System.out.println("+++ testSingleThreadedRestoreStack");
+
+ Principal jduke1 = new SimplePrincipal("jduke1");
+ Subject subject1 = new Subject();
+ SecurityAssociation.pushSubjectContext(subject1, jduke1, "theduke1");
+
+ Principal jduke2 = new SimplePrincipal("jduke2");
+ Subject subject2 = new Subject();
+ SecurityAssociation.pushSubjectContext(subject2, jduke2, "theduke2");
+
+ UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke3",
+ "theduke3");
+ LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
+ lc.login();
+ Subject subject = lc.getSubject();
+ System.out.println("LC.Subject: "+subject);
+
+ Principal jduke3 = new SimplePrincipal("jduke3");
+ assertTrue("Principals contains jduke3", subject.getPrincipals().contains(jduke3));
+ Principal saPrincipal = SecurityAssociation.getPrincipal();
+ assertTrue("SecurityAssociation.getPrincipal == jduke3", saPrincipal.equals(jduke3));
+ char[] password = (char[]) SecurityAssociation.getCredential();
+ assertTrue("password == theduke3",
+ Arrays.equals(password, "theduke3".toCharArray()));
+ SecurityAssociation.SubjectContext sc3 = SecurityAssociation.peekSubjectContext();
+ System.out.println(sc3);
+ assertTrue("SecurityAssociation.peekSubjectContext == jduke3", sc3.getPrincipal().equals(jduke3));
+ char[] theduke3 = (char[]) sc3.getCredential();
+ assertTrue("password == theduke3",
+ Arrays.equals(theduke3, "theduke3".toCharArray()));
+
+ lc.logout();
+
+ // Validate restored state
+ SecurityAssociation.SubjectContext sc2 = SecurityAssociation.peekSubjectContext();
+ System.out.println(sc2);
+ assertTrue("SecurityAssociation.peekSubjectContext == jduke2", sc2.getPrincipal().equals(jduke2));
+ String theduke2 = (String) sc2.getCredential();
+ assertTrue("password == theduke2", theduke2.equals("theduke2"));
+
+ SecurityAssociation.popSubjectContext();
+ SecurityAssociation.SubjectContext sc1 = SecurityAssociation.peekSubjectContext();
+ System.out.println(sc1);
+ assertTrue("SecurityAssociation.peekSubjectContext == jduke1", sc1.getPrincipal().equals(jduke1));
+ String theduke1 = (String) sc1.getCredential();
+ assertTrue("password == theduke1", theduke1.equals("theduke1"));
+ }
+
+ public void testMultiThreaded() throws Exception
+ {
+ TestMultiThreaded r0 = new TestMultiThreaded();
+ Thread t0 = new Thread(r0, "testMultiThreaded#0");
+ t0.start();
+ TestMultiThreaded r1 = new TestMultiThreaded();
+ Thread t1 = new Thread(r1, "testMultiThreaded#1");
+ t1.start();
+
+ t0.join();
+ assertTrue(r0.failure == null);
+ t1.join();
+ assertTrue(r1.failure == null);
+ }
+ static class TestMultiThreaded implements Runnable
+ {
+ Exception failure;
+ public void run()
+ {
+ try
+ {
+ System.out.println("+++ testMultiThreadedRunnable");
+ UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke",
+ "theduke");
+ LoginContext lc = new LoginContext("testSingleThreaded", handler);
+ lc.login();
+ Subject subject = lc.getSubject();
+ System.out.println("LC.Subject: "+subject);
+ Principal theduke = new SimplePrincipal("jduke");
+ assertTrue("Principals contains theduke", subject.getPrincipals().contains(theduke));
+ Principal saPrincipal = SecurityAssociation.getPrincipal();
+ assertTrue("SecurityAssociation.getPrincipal == theduke", saPrincipal.equals(theduke));
+ char[] password = (char[]) SecurityAssociation.getCredential();
+ assertTrue("password == theduke",
+ Arrays.equals(password, "theduke".toCharArray()));
+ }
+ catch(Exception e)
+ {
+ failure = e;
+ }
+ }
+ }
+
+ public void testMultiThreadedRestoreIdentity() throws Exception
+ {
+ TestMultiThreadedRestoreIdentity r0 = new TestMultiThreadedRestoreIdentity();
+ Thread t0 = new Thread(r0, "testMultiThreadedRestoreIdentity#0");
+ t0.start();
+ TestMultiThreadedRestoreIdentity r1 = new TestMultiThreadedRestoreIdentity();
+ Thread t1 = new Thread(r1, "testMultiThreadedRestoreIdentity#1");
+ t1.start();
+
+ t0.join();
+ assertTrue(r0.failure == null);
+ t1.join();
+ assertTrue(r1.failure == null);
+ }
+ static class TestMultiThreadedRestoreIdentity implements Runnable
+ {
+ Exception failure;
+ public void run()
+ {
+ try
+ {
+ System.out.println("+++ testMultiThreadedRestoreIdentity");
+
+ Principal jduke1 = new SimplePrincipal("jduke1");
+ SecurityAssociation.setPrincipal(jduke1);
+ SecurityAssociation.setCredential("theduke1");
+
+ UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke2",
+ "theduke2");
+ LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
+ lc.login();
+ Subject subject = lc.getSubject();
+ System.out.println("LC.Subject: "+subject);
+
+ Principal jduke2 = new SimplePrincipal("jduke2");
+ assertTrue("Principals contains jduke2", subject.getPrincipals().contains(jduke2));
+ Principal saPrincipal = SecurityAssociation.getPrincipal();
+ assertTrue("SecurityAssociation.getPrincipal == jduke2", saPrincipal.equals(jduke2));
+ char[] password = (char[]) SecurityAssociation.getCredential();
+ assertTrue("password == theduke2",
+ Arrays.equals(password, "theduke2".toCharArray()));
+
+ lc.logout();
+ // Validate restored state
+ saPrincipal = SecurityAssociation.getPrincipal();
+ assertTrue("SecurityAssociation.getPrincipal == jduke1", saPrincipal.equals(jduke1));
+ String theduke1 = (String) SecurityAssociation.getCredential();
+ assertTrue("password == theduke1", theduke1.equals("theduke1"));
+
+ }
+ catch(Exception e)
+ {
+ failure = e;
+ }
+ }
+ }
+
+ public void testMultiThreadedRestoreStack() throws Exception
+ {
+ TestMultiThreadedRestoreStack r0 = new TestMultiThreadedRestoreStack();
+ Thread t0 = new Thread(r0, "testMultiThreadedRestoreIdentity#0");
+ t0.start();
+ TestMultiThreadedRestoreStack r1 = new TestMultiThreadedRestoreStack();
+ Thread t1 = new Thread(r1, "testMultiThreadedRestoreIdentity#1");
+ t1.start();
+
+ t0.join();
+ assertTrue(r0.failure == null);
+ t1.join();
+ assertTrue(r1.failure == null);
+ }
+ static class TestMultiThreadedRestoreStack implements Runnable
+ {
+ Exception failure;
+ @SuppressWarnings("deprecation")
+ public void run()
+ {
+ try
+ {
+ System.out.println("+++ testMultThreadedRestoreStack");
+
+ Principal jduke1 = new SimplePrincipal("jduke1");
+ Subject subject1 = new Subject();
+ SecurityAssociation.pushSubjectContext(subject1, jduke1, "theduke1");
+
+ Principal jduke2 = new SimplePrincipal("jduke2");
+ Subject subject2 = new Subject();
+ SecurityAssociation.pushSubjectContext(subject2, jduke2, "theduke2");
+
+ UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke3",
+ "theduke3");
+ LoginContext lc = new LoginContext("testSingleThreadedRestoreIdentity", handler);
+ lc.login();
+ Subject subject = lc.getSubject();
+ System.out.println("LC.Subject: "+subject);
+
+ Principal jduke3 = new SimplePrincipal("jduke3");
+ assertTrue("Principals contains jduke3", subject.getPrincipals().contains(jduke3));
+ Principal saPrincipal = SecurityAssociation.getPrincipal();
+ assertTrue("SecurityAssociation.getPrincipal == jduke3", saPrincipal.equals(jduke3));
+ char[] password = (char[]) SecurityAssociation.getCredential();
+ assertTrue("password == theduke3",
+ Arrays.equals(password, "theduke3".toCharArray()));
+ SecurityAssociation.SubjectContext sc3 = SecurityAssociation.peekSubjectContext();
+ System.out.println(sc3);
+ assertTrue("SecurityAssociation.peekSubjectContext == jduke3", sc3.getPrincipal().equals(jduke3));
+ char[] theduke3 = (char[]) sc3.getCredential();
+ assertTrue("password == theduke3",
+ Arrays.equals(theduke3, "theduke3".toCharArray()));
+
+ lc.logout();
+
+ // Validate restored state
+ SecurityAssociation.SubjectContext sc2 = SecurityAssociation.peekSubjectContext();
+ System.out.println(sc2);
+ assertTrue("SecurityAssociation.peekSubjectContext == jduke2", sc2.getPrincipal().equals(jduke2));
+ String theduke2 = (String) sc2.getCredential();
+ assertTrue("password == theduke2", theduke2.equals("theduke2"));
+
+ SecurityAssociation.popSubjectContext();
+ SecurityAssociation.SubjectContext sc1 = SecurityAssociation.peekSubjectContext();
+ System.out.println(sc1);
+ assertTrue("SecurityAssociation.peekSubjectContext == jduke1", sc1.getPrincipal().equals(jduke1));
+ String theduke1 = (String) sc1.getCredential();
+ assertTrue("password == theduke1", theduke1.equals("theduke1"));
+ }
+ catch(Exception e)
+ {
+ failure = e;
+ }
+ }
+ }
+
+ //SECURITY-339: ClientLoginModule abort should not clear security context
+ public void testAbortWithRestore() throws Exception
+ {
+ SecurityContext sc = SecurityContextFactory.createSecurityContext("test");
+ SecurityContextAssociation.setSecurityContext(sc);
+
+ //Start with successful login. Then a failed login
+ UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke", "jduke");
+ LoginContext lc = new LoginContext("testAbortWithRestore", handler);
+ lc.login();
+ Subject subject = lc.getSubject();
+ assertNotNull("Subject is not null", subject);
+
+ SecurityContext currentSC = SecurityContextAssociation.getSecurityContext();
+ assertNotNull("Current Security Context is not null", currentSC);
+ verifySubjectInfo(currentSC);
+
+ //Failed Login
+ handler = new UsernamePasswordHandler("jduke", "BAD_PASSWORD");
+ lc = new LoginContext("testAbortWithRestore", handler);
+ try
+ {
+ lc.login();
+ fail("Should have failed");
+ }
+ catch(LoginException le)
+ {
+ //pass
+ }
+ subject = lc.getSubject();
+ assertNull("Subject from login context is null", subject);
+
+ currentSC = SecurityContextAssociation.getSecurityContext();
+ assertNotNull("Current Security Context is not null", currentSC);
+ verifySubjectInfo(currentSC);
+
+
+ //Successful Login
+ SecurityContextAssociation.setSecurityContext(sc);
+ handler = new UsernamePasswordHandler("jduke", "jduke");
+ lc = new LoginContext("testAbortWithRestore", handler);
+ lc.login();
+ subject = lc.getSubject();
+ assertNotNull("Subject is not null", subject);
+
+ currentSC = SecurityContextAssociation.getSecurityContext();
+ assertNotNull("Current Security Context is not null", currentSC);
+ verifySubjectInfo(currentSC);
+
+ //Failed Login
+ handler = new UsernamePasswordHandler("jduke", "BAD_PASSWORD");
+ lc = new LoginContext("testAbortWithRestore", handler);
+ try
+ {
+ lc.login();
+ fail("Should have failed");
+ }
+ catch(LoginException le)
+ {
+ //pass
+ }
+ subject = lc.getSubject();
+ assertNull("Subject is null", subject);
+
+ currentSC = SecurityContextAssociation.getSecurityContext();
+ assertNotNull("Current Security Context is not null", currentSC);
+ verifySubjectInfo(currentSC);
+
+ lc.logout();
+ subject = lc.getSubject();
+ assertNull("Subject from login context is null", subject);
+ }
+
+ //SECURITY-339: ClientLoginModule abort should not clear security context
+ public void testAbortWithNoRestore() throws Exception
+ {
+ SecurityContext sc = SecurityContextFactory.createSecurityContext("test");
+ SecurityContextAssociation.setSecurityContext(sc);
+
+ //Successful Login
+ SecurityContextAssociation.setSecurityContext(sc);
+ UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke", "jduke");
+ LoginContext lc = new LoginContext("testAbortWithNoRestore", handler);
+ lc.login();
+ Subject subject = lc.getSubject();
+ assertNotNull("Subject is not null", subject);
+
+ SecurityContext currentSC = SecurityContextAssociation.getSecurityContext();
+ assertNotNull("Current Security Context is not null", currentSC);
+ this.verifySubjectInfo(currentSC);
+
+ //Failed Login - calls abort on the login modules
+ handler = new UsernamePasswordHandler("BAD_USER", "BAD_PASSWORD");
+ lc = new LoginContext("testAbortWithNoRestore", handler);
+ try
+ {
+ lc.login();
+ fail("Should have failed");
+ }
+ catch(LoginException le)
+ {
+ //pass
+ }
+ //Ensure that the failed login context does not return a subject
+ subject = lc.getSubject();
+ assertNull("Subject is null", subject);
+
+ //We have to ensure that the first successful authentication has not been removed from the stack
+ currentSC = SecurityContextAssociation.getSecurityContext();
+ assertNotNull("Current Security Context is not null", currentSC);
+ this.verifySubjectInfo(currentSC);
+
+ //Let us go through some logout cycles
+ handler = new UsernamePasswordHandler("jduke", "jduke");
+ lc = new LoginContext("testAbortWithNoRestore", handler);
+ lc.login();
+ subject = lc.getSubject();
+ assertNotNull("Subject is not null", subject);
+
+ currentSC = SecurityContextAssociation.getSecurityContext();
+ assertNotNull("Current Security Context is not null", currentSC);
+ this.verifySubjectInfo(currentSC);
+
+ lc.logout();
+
+ assertNull("Current Security Context is null", SecurityContextAssociation.getSecurityContext());
+ subject = lc.getSubject();
+ assertEquals("Subject from login context has no principals", 0, subject.getPrincipals().size());
+
+ sc = SecurityContextFactory.createSecurityContext("test");
+ SecurityContextAssociation.setSecurityContext(sc);
+
+ //Failed Login - calls abort on the login modules
+ handler = new UsernamePasswordHandler("BAD_USER", "BAD_PASSWORD");
+ lc = new LoginContext("testAbortWithNoRestore", handler);
+ try
+ {
+ lc.login();
+ fail("Should have failed");
+ }
+ catch(LoginException le)
+ {
+ //pass
+ }
+ //Ensure that the failed login context does not return a subject
+ subject = lc.getSubject();
+ assertNull("Subject is null", subject);
+
+ //We have to ensure that the first successful authentication has not been removed from the stack
+ currentSC = SecurityContextAssociation.getSecurityContext();
+ assertNotNull("Current Security Context is not null", currentSC);
+ SubjectInfo subjectInfo = currentSC.getSubjectInfo();
+ assertNotNull("SubjectInfo", subjectInfo);
+ subject = subjectInfo.getAuthenticatedSubject();
+ assertNull("Subject is null", subject);
+ assertNull("Principal on security context is null", currentSC.getUtil().getUserPrincipal());
+ assertNull("Principal on legacy security association is null", SecurityAssociation.getPrincipal());
+ }
+
+ private void verifySubjectInfo(SecurityContext currentSC)
+ {
+ SubjectInfo subjectInfo = currentSC.getSubjectInfo();
+ assertNotNull("SubjectInfo", subjectInfo);
+ Subject subject = subjectInfo.getAuthenticatedSubject();
+ assertNotNull("Subject is not null", subject);
+ Principal jduke = new SimplePrincipal("jduke");
+ assertTrue("jduke exists in the subject",subject.getPrincipals().contains(jduke));
+ assertEquals("jduke exists", jduke, currentSC.getUtil().getUserPrincipal());
+ assertEquals("jduke exists", jduke, SecurityAssociation.getPrincipal());
+ }
+}
\ No newline at end of file
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/LdapLoginModuleDecodeActionUnitTestCase.java (from rev 91964, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/authentication/jaas/LdapLoginModuleDecodeActionUnitTestCase.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/LdapLoginModuleDecodeActionUnitTestCase.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/authentication/jaas/LdapLoginModuleDecodeActionUnitTestCase.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,139 @@
+/*
+ * 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.test.authentication.jaas;
+
+import java.io.File;
+import java.util.HashMap;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.LoginContext;
+
+import org.jboss.security.auth.callback.AppCallbackHandler;
+import org.jboss.security.auth.spi.LdapLoginModule;
+import org.jboss.test.security.ldap.OpenDSUnitTestCase;
+
+/**
+ * SECURITY-426: DecodeAction is not using JaasSecurityDomain MBean
+ * @author Anil.Saldhana at redhat.com
+ */
+public class LdapLoginModuleDecodeActionUnitTestCase extends OpenDSUnitTestCase
+{
+ private String oname = "jboss.test:service=jaasSecurityDomain";
+
+ public LdapLoginModuleDecodeActionUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ //load it up with example1.ldif
+ String fileName = targetDir + "ldap" + fs + "example1.ldif";
+ boolean op = util.addLDIF(serverHost, port, adminDN, adminPW, new File(fileName).toURL());
+ assertTrue(op);
+
+ //Setup a configuration
+ Configuration.setConfiguration(new Configuration()
+ {
+ @SuppressWarnings("unchecked")
+ @Override
+ public AppConfigurationEntry[] getAppConfigurationEntry(String cname)
+ {
+ String name = LdapLoginModule.class.getName();
+ HashMap options = new HashMap();
+
+ options.put("java.naming.factory.initial", ldapCtxFactory);
+ options.put("java.naming.provider.url","ldap://localhost:10389/");
+ options.put("java.naming.security.authentication","simple");
+ options.put("principalDNPrefix","uid=");
+ options.put("uidAttributeID","userid");
+ options.put("roleAttributeID","roleName");
+ options.put("principalDNSuffix",",ou=People,dc=jboss,dc=org");
+ options.put("rolesCtxDN","cn=JBossSX Tests,ou=Roles,dc=jboss,dc=org");
+ options.put(Context.SECURITY_CREDENTIALS, "somecrazyencryptedstring");
+ options.put("jaasSecurityDomain", oname);
+
+
+ AppConfigurationEntry ace = new AppConfigurationEntry(name,
+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options);
+ AppConfigurationEntry[] entry = {ace};
+ return entry;
+ }
+
+ @Override
+ public void refresh()
+ {
+ }
+ });
+
+ //Setup MBeanServer
+ MBeanServer jbossMBeanServer = MBeanServerFactory.createMBeanServer("jboss");
+ try
+ {
+ Test test = new Test();
+ jbossMBeanServer.registerMBean(test, new ObjectName(oname));
+ //jbossMBeanServer.createMBean(Test.class.getName(), new ObjectName(oname), getClass().getClassLoader());
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void testLDAPAddDelete() throws Exception
+ {
+ //Ignore
+ }
+
+ public void testLDAPDecodeAction() throws Exception
+ {
+ LoginContext lc = new LoginContext("test", new AppCallbackHandler("jduke","theduke".toCharArray()));
+ lc.login();
+ }
+
+ //We create a MBean that has just one operation for testing purposes
+ public interface TestMBean
+ {
+ byte[] decode64(byte[] secret) throws Exception;
+ }
+
+ public class Test implements TestMBean
+ {
+ public Test()
+ {
+ }
+
+ //In JBoss environment, the JaasSecurityDomain mbean will perform the decoding
+ public byte[] decode64(byte[] secret) throws Exception
+ {
+ return "theduke".getBytes();
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestCase.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestCase.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestCase.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,153 +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.ldap;
-
-import java.io.File;
-import java.util.Hashtable;
-
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.jboss.test.JBossTestCase;
-
-/**
- * Test Basic OpenDS functionality
- * @author Anil.Saldhana at redhat.com
- * @since Aug 23, 2007
- * @version $Revision$
- */
-public class OpenDSUnitTestCase extends JBossTestCase
-{
- private String serverHost;
- private String port = "10389";
- private String adminPW = "password";
- private String dn = "dc=jboss,dc=org";
- private String adminDN = "cn=Directory Manager";
- private OpenDSUtil util = new OpenDSUtil();
-
- /**
- * Use a different value for the system property on
- * a JVM that is not shipped by Sun
- */
- String ldapCtxFactory = System.getProperty("ldapctx.factory",
- "com.sun.jndi.ldap.LdapCtxFactory");
-
- String baseDir = System.getProperty("user.dir");
- String fs = System.getProperty("file.separator");
-
- String targetDir = "target" + fs + "test-classes" + fs;
- String openDSDir = targetDir + "opends" ;
-
- OpenDS opends = null;
-
- public OpenDSUnitTestCase(String name)
- {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- serverHost = getServerHost();
-
- opends = new OpenDS();
- opends.intialize(openDSDir);
- opends.startServer();
- assertTrue(opends.isRunning());
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown();
- assertTrue("DS is running",opends.isRunning());
- shutdown();
- assertFalse("DS is not running",opends.isRunning());
- }
-
- public void testLDAPAddDelete() throws Exception
- {
- String fileName = targetDir + "ldap" + fs + "example1.ldif";
- boolean op = util.addLDIF(serverHost, port, adminDN, adminPW, new File(fileName).toURL());
- assertTrue(op);
-
- DirContext dc = null;
- NamingEnumeration<SearchResult> ne = null;
- try
- {
- dc = this.getDirContext();
- assertNotNull("DirContext exists?", dc);
-
- //Use JDK JNDI code for a search
- SearchControls sc = new SearchControls();
- sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
- ne = dc.search(dn, "(objectclass=*)", sc);
- while (ne.hasMore())
- {
- SearchResult sr = ne.next();
- assertTrue("Search Result exists?", sr != null);
- }
-
- //We will delete the DIT just created
- assertTrue(util.deleteDNRecursively(serverHost, port, adminDN, adminPW, dn));
-
- assertFalse("The DIT does not exist", util.existsDN(serverHost, port, dn));
- }
- catch(Exception e)
- {
- System.err.println("Error in searching:");
- e.printStackTrace();
- }
-
- finally
- {
- if(ne != null)
- ne.close();
- if(dc != null)
- dc.close();
- }
- }
-
- private void shutdown() throws Exception
- {
- //Check if the server is running
- if(opends.isRunning())
- opends.stopServer();
- }
-
- private DirContext getDirContext() throws Exception
- {
- String url = "ldap://" + serverHost + ":" + port;
- Hashtable<String, String> env = new Hashtable<String,String>();
- env.put(Context.INITIAL_CONTEXT_FACTORY, ldapCtxFactory);
- env.put(Context.PROVIDER_URL, url);
- env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, adminDN);
- env.put(Context.SECURITY_CREDENTIALS, adminPW);
- return new InitialDirContext(env);
- }
-}
\ No newline at end of file
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestCase.java (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestCase.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestCase.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestCase.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,190 @@
+/*
+ * 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.ldap;
+
+import java.io.File;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Test Basic OpenDS functionality
+ * @author Anil.Saldhana at redhat.com
+ * @since Aug 23, 2007
+ * @version $Revision$
+ */
+public class OpenDSUnitTestCase extends JBossTestCase
+{
+ protected String serverHost;
+ protected String port = "10389";
+ protected String adminPW = "password";
+ protected String dn = "dc=jboss,dc=org";
+ protected String adminDN = "cn=Directory Manager";
+ protected OpenDSUtil util = new OpenDSUtil();
+
+ /**
+ * Use a different value for the system property on
+ * a JVM that is not shipped by Sun
+ */
+ protected String ldapCtxFactory = System.getProperty("ldapctx.factory",
+ "com.sun.jndi.ldap.LdapCtxFactory");
+
+ protected String baseDir = System.getProperty("user.dir");
+ protected String fs = System.getProperty("file.separator");
+
+ //System property when running in eclipse (-Declipse=jbosssx/ )
+ private String eclipsePath = System.getProperty("eclipse","");
+
+ protected String targetDir = eclipsePath + "target" + fs + "test-classes" + fs;
+ protected String openDSDir = targetDir + "opends" ;
+
+ protected OpenDS opends = null;
+
+ public OpenDSUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ //Ensure openDSDir exists and recycle opends db dir
+ File openDSDirFile = new File(openDSDir);
+ if(openDSDirFile.exists())
+ {
+ File dbDir = new File(openDSDir + fs + "db");
+ assertTrue("Deletion of opendsDir db success", recursiveDeleteDir(dbDir));
+ assertTrue("Creation of opendsDir DB success", dbDir.mkdirs());
+ }
+
+ serverHost = getServerHost();
+
+ opends = new OpenDS();
+ opends.intialize(openDSDir);
+ if(opends.isRunning())
+ opends.stopServer();
+ opends.startServer();
+ assertTrue(opends.isRunning());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ assertTrue("DS is running",opends.isRunning());
+ shutdown();
+ assertFalse("DS is not running",opends.isRunning());
+ }
+
+ public void testLDAPAddDelete() throws Exception
+ {
+ String fileName = targetDir + "ldap" + fs + "example1.ldif";
+ boolean op = util.addLDIF(serverHost, port, adminDN, adminPW, new File(fileName).toURL());
+ assertTrue(op);
+
+ DirContext dc = null;
+ NamingEnumeration<SearchResult> ne = null;
+ try
+ {
+ dc = this.getDirContext();
+ assertNotNull("DirContext exists?", dc);
+
+ //Use JDK JNDI code for a search
+ SearchControls sc = new SearchControls();
+ sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
+ ne = dc.search(dn, "(objectclass=*)", sc);
+ while (ne.hasMore())
+ {
+ SearchResult sr = ne.next();
+ assertTrue("Search Result exists?", sr != null);
+ }
+
+ //We will delete the DIT just created
+ assertTrue(util.deleteDNRecursively(serverHost, port, adminDN, adminPW, dn));
+
+ assertFalse("The DIT does not exist", util.existsDN(serverHost, port, dn));
+ }
+ catch(Exception e)
+ {
+ System.err.println("Error in searching:");
+ e.printStackTrace();
+ }
+
+ finally
+ {
+ if(ne != null)
+ ne.close();
+ if(dc != null)
+ dc.close();
+ }
+ }
+
+ protected void shutdown() throws Exception
+ {
+ //Check if the server is running
+ if(opends.isRunning())
+ opends.stopServer();
+ }
+
+ private DirContext getDirContext() throws Exception
+ {
+ String url = "ldap://" + serverHost + ":" + port;
+ Hashtable<String, String> env = new Hashtable<String,String>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, ldapCtxFactory);
+ env.put(Context.PROVIDER_URL, url);
+ env.put(Context.SECURITY_AUTHENTICATION, "simple");
+ env.put(Context.SECURITY_PRINCIPAL, adminDN);
+ env.put(Context.SECURITY_CREDENTIALS, adminPW);
+ return new InitialDirContext(env);
+ }
+
+ private boolean recursiveDeleteDir(File dirPath)
+ {
+ if( dirPath.exists() )
+ {
+ File[] files = dirPath.listFiles();
+ for(int i=0; i<files.length; i++)
+ {
+ if(files[i].isDirectory())
+ {
+ recursiveDeleteDir(files[i]);
+ }
+ else
+ {
+ files[i].delete();
+ }
+ }
+ }
+ if(dirPath.exists())
+ return dirPath.delete();
+ else
+ return true;
+ }
+}
\ No newline at end of file
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestsAdapter.java (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestsAdapter.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestsAdapter.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/ldap/OpenDSUnitTestsAdapter.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,41 @@
+/*
+ * 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.test.security.ldap;
+
+/**
+ * Adapter for the OpenDS unit tests
+ * @author Anil.Saldhana at redhat.com
+ */
+public class OpenDSUnitTestsAdapter extends OpenDSUnitTestCase
+{
+ public OpenDSUnitTestsAdapter(String name)
+ {
+ super(name);
+ }
+
+
+ @Override
+ public void testLDAPAddDelete() throws Exception
+ {
+ }
+
+}
\ No newline at end of file
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/mapping/LdapAttributeMappingProviderUnitTestCase.java (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/security/mapping/LdapAttributeMappingProviderUnitTestCase.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/mapping/LdapAttributeMappingProviderUnitTestCase.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/security/mapping/LdapAttributeMappingProviderUnitTestCase.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,138 @@
+/*
+ * 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.test.security.mapping;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextFactory;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.config.ApplicationPolicy;
+import org.jboss.security.config.MappingInfo;
+import org.jboss.security.config.ModuleOption;
+import org.jboss.security.config.SecurityConfiguration;
+import org.jboss.security.identity.Attribute;
+import org.jboss.security.mapping.MappingContext;
+import org.jboss.security.mapping.MappingManager;
+import org.jboss.security.mapping.MappingType;
+import org.jboss.security.mapping.config.MappingModuleEntry;
+import org.jboss.security.mapping.providers.attribute.LdapAttributeMappingProvider;
+import org.jboss.test.security.ldap.OpenDSUnitTestsAdapter;
+
+/**
+ * LdapAttributeMappingProvider tests
+ * @author Anil.Saldhana at redhat.com
+ */
+public class LdapAttributeMappingProviderUnitTestCase extends OpenDSUnitTestsAdapter
+{
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new LdapAttributeMappingProviderUnitTestCase("testLDAPAttributes"));
+ return suite;
+ }
+
+ public LdapAttributeMappingProviderUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ ApplicationPolicy ap = new ApplicationPolicy("test");
+ SecurityConfiguration.addApplicationPolicy(ap);
+
+ //Let us add the ldapAttributes.ldif
+ String fileName = targetDir + "ldap" + fs + "ldapAttributes.ldif";
+ boolean op = util.addLDIF(serverHost, port, adminDN, adminPW, new File(fileName).toURL());
+ assertTrue(op);
+ }
+
+ public void testLDAPAttributes() throws Exception
+ {
+ ApplicationPolicy ap = SecurityConfiguration.getApplicationPolicy("test");
+ MappingModuleEntry mme = new MappingModuleEntry(LdapAttributeMappingProvider.class.getName());
+
+ String attributeList = "mail,cn,commonname,givenname,surname,employeeType," +
+ "employeeNumber,facsimileTelephoneNumber";
+ mme.add(new ModuleOption("bindDN",this.adminDN));
+ mme.add(new ModuleOption("bindCredential",this.adminPW));
+ mme.add(new ModuleOption("baseFilter","(uid={0})"));
+ mme.add(new ModuleOption("java.naming.provider.url", "ldap://" + serverHost + ":" + port));
+ mme.add(new ModuleOption("baseCtxDN", "ou=People,dc=jboss,dc=org"));
+ mme.add(new ModuleOption("attributeList", attributeList));
+
+ MappingInfo attributeMappingInfo = new MappingInfo();
+ attributeMappingInfo.add(mme);
+ ap.setMappingInfo(MappingType.ATTRIBUTE.name(),attributeMappingInfo);
+
+ SecurityContext sc = SecurityContextFactory.createSecurityContext("test");
+ MappingManager mm = sc.getMappingManager();
+ assertNotNull("MappingManager != null", mm);
+
+ MappingContext<List<Attribute<String>>> mc = mm.getMappingContext(MappingType.ATTRIBUTE.name());
+ assertNotNull("MappingContext != null", mc);
+ HashMap<String,Object> map = new HashMap<String,Object>();
+
+ map.put(SecurityConstants.PRINCIPAL_IDENTIFIER, new SimplePrincipal("jduke"));
+
+ List<Attribute<String>> attList = new ArrayList<Attribute<String>>();
+
+ mc.performMapping(map, attList);
+ attList = (List<Attribute<String>>) mc.getMappingResult().getMappedObject();
+
+ boolean foundEmail = false;
+ boolean foundEmployeeType = false;
+ boolean foundEmployeeNumber = false;
+
+ for(Attribute<String> att: attList)
+ {
+ String attName = att.getName();
+ if(attName.equals(Attribute.TYPE.EMAIL_ADDRESS.get()))
+ {
+ assertEquals("theduke at somecastle.man",att.getValue());
+ foundEmail = true;
+ }
+ if(attName.equals("employeeType"))
+ {
+ assertEquals("permanent",att.getValue());
+ foundEmployeeType = true;
+ }
+ if(attName.equals("employeeNumber"))
+ {
+ assertEquals("007",att.getValue());
+ foundEmployeeNumber = true;
+ }
+ }
+ assertTrue("Found Email", foundEmail);
+ assertTrue("Found Emp Type", foundEmployeeType);
+ assertTrue("Found Emp Number", foundEmployeeNumber);
+ }
+}
\ No newline at end of file
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/MappingContextTestCase.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/securitycontext/MappingContextTestCase.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/MappingContextTestCase.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,72 +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.test.securitycontext;
-
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.jboss.security.SecurityConstants;
-import org.jboss.security.SecurityContext;
-import org.jboss.security.config.SecurityConfiguration;
-import org.jboss.security.identity.RoleGroup;
-import org.jboss.security.identity.plugins.SimpleRole;
-import org.jboss.security.identity.plugins.SimpleRoleGroup;
-import org.jboss.security.mapping.MappingContext;
-
-//$Id$
-
-/**
- * Test the various mapping providers
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Dec 26, 2006
- * @version $Revision$
- */
-public class MappingContextTestCase extends SecurityContextBaseTest
-{
- public void testDeploymentRolesProvider()
- {
- SecurityConfiguration.addApplicationPolicy(createApplicationPolicy(securityDomain));
- SecurityContext sc= getSC(securityDomain);
- HashSet<String> hs = new HashSet<String>();
- hs.add("t1");
- hs.add("t2");
-
- HashMap<String,Object> rolesMap = new HashMap<String,Object>();
- rolesMap.put(principal.getName(), hs );
-
- HashMap<String,Object> map = new HashMap<String,Object>();
- map.put(SecurityConstants.PRINCIPAL_IDENTIFIER, principal);
- map.put(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP, rolesMap);
-
- RoleGroup grp = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
- grp.addRole(new SimpleRole("oldRole"));
- //grp.addMember(new SimplePrincipal("oldRole"));
- MappingContext<RoleGroup> mc = sc.getMappingManager().getMappingContext(RoleGroup.class);
- mc.performMapping(map, grp);
-
- grp = (RoleGroup) mc.getMappingResult().getMappedObject();
-
- assertFalse("oldRole does not exist", grp.containsRole(new SimpleRole("oldRole")));
- assertTrue("t1 exists?",grp.containsRole(new SimpleRole("t1")));
- assertTrue("t2 exists?",grp.containsRole(new SimpleRole("t2")));
- }
-}
\ No newline at end of file
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/MappingContextTestCase.java (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/securitycontext/MappingContextTestCase.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/MappingContextTestCase.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/MappingContextTestCase.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,109 @@
+/*
+ * 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.test.securitycontext;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.config.SecurityConfiguration;
+import org.jboss.security.identity.Attribute;
+import org.jboss.security.identity.RoleGroup;
+import org.jboss.security.identity.plugins.SimpleRole;
+import org.jboss.security.identity.plugins.SimpleRoleGroup;
+import org.jboss.security.mapping.MappingContext;
+import org.jboss.security.mapping.MappingType;
+
+
+/**
+ * Test the various mapping providers
+ * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ * @since Dec 26, 2006
+ * @version $Revision$
+ */
+public class MappingContextTestCase extends SecurityContextBaseTest
+{
+ @SuppressWarnings("deprecation")
+ public void testDeploymentRolesProvider()
+ {
+ SecurityConfiguration.addApplicationPolicy(createApplicationPolicy(securityDomain));
+ SecurityContext sc= getSC(securityDomain);
+ HashSet<String> hs = new HashSet<String>();
+ hs.add("t1");
+ hs.add("t2");
+
+ HashMap<String,Object> rolesMap = new HashMap<String,Object>();
+ rolesMap.put(principal.getName(), hs );
+
+ HashMap<String,Object> map = new HashMap<String,Object>();
+ map.put(SecurityConstants.PRINCIPAL_IDENTIFIER, principal);
+ map.put(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP, rolesMap);
+
+ RoleGroup grp = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
+ grp.addRole(new SimpleRole("oldRole"));
+
+ MappingContext<RoleGroup> mc = sc.getMappingManager().getMappingContext(RoleGroup.class);
+ assertNotNull("Mapping Context is not null", mc);
+ mc.performMapping(map, grp);
+
+ grp = (RoleGroup) mc.getMappingResult().getMappedObject();
+
+ assertFalse("oldRole does not exist", grp.containsRole(new SimpleRole("oldRole")));
+ assertTrue("t1 exists?",grp.containsRole(new SimpleRole("t1")));
+ assertTrue("t2 exists?",grp.containsRole(new SimpleRole("t2")));
+ }
+
+ public void testAttributeProvider()
+ {
+ SecurityConfiguration.addApplicationPolicy(createApplicationPolicy(securityDomain));
+ SecurityContext sc= getSC(securityDomain);
+ HashSet<String> hs = new HashSet<String>();
+ hs.add("t1");
+ hs.add("t2");
+
+ HashMap<String,Object> rolesMap = new HashMap<String,Object>();
+ rolesMap.put(principal.getName(), hs );
+
+ HashMap<String,Object> map = new HashMap<String,Object>();
+ map.put(SecurityConstants.PRINCIPAL_IDENTIFIER, principal);
+
+ List<Attribute<String>> attrList = new ArrayList<Attribute<String>>();
+
+ MappingContext<List<Attribute<String>>> mc = sc.getMappingManager().getMappingContext(MappingType.ATTRIBUTE.name());
+ assertNotNull("Mapping Context is not null", mc);
+ mc.performMapping(map, attrList);
+
+ attrList = (List<Attribute<String>>) mc.getMappingResult().getMappedObject();
+
+ assertNotNull("Attribute List not null", attrList);
+
+ for(Attribute<?> att: attrList)
+ {
+ //Email address
+ if(Attribute.TYPE.EMAIL_ADDRESS.get().equals(att.getName()))
+ assertEquals("anil at test", att.getValue());
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/SecurityContextBaseTest.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/securitycontext/SecurityContextBaseTest.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/SecurityContextBaseTest.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,96 +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.test.securitycontext;
-
-import java.security.Principal;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.jboss.security.SimplePrincipal;
-import org.jboss.security.config.ApplicationPolicy;
-import org.jboss.security.config.RoleMappingInfo;
-import org.jboss.security.config.SecurityConfiguration;
-import org.jboss.security.mapping.config.MappingModuleEntry;
-import org.jboss.security.plugins.JBossSecurityContext;
-
-//$Id$
-
-/**
- * Base test class with common methods
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Dec 26, 2006
- * @version $Revision$
- */
-public class SecurityContextBaseTest extends TestCase
-{
- protected Principal principal = new SimplePrincipal("anil");
- protected Object cred = "hello";
- protected String securityDomain = "other";
-
- private String mappingModule = "org.jboss.security.mapping.providers.DeploymentRolesMappingProvider";
-
- public void testSecurityConfiguration()
- {
- ApplicationPolicy ap = createApplicationPolicy(securityDomain);
- SecurityConfiguration.addApplicationPolicy(ap);
- assertEquals(SecurityConfiguration.getApplicationPolicy(securityDomain), ap);
- }
-
- protected JBossSecurityContext getSC(String domain)
- {
- if(domain == null)
- domain = securityDomain;
- return new JBossSecurityContext(securityDomain);
- }
-
- protected ApplicationPolicy createApplicationPolicy(String domain)
- {
- ApplicationPolicy ap = new ApplicationPolicy(domain);
- ap.setRoleMappingInfo(createRoleMappingInfo(domain));
- return ap;
- }
-
- protected ApplicationPolicy createApplicationPolicy(String domain, RoleMappingInfo rmi)
- {
- ApplicationPolicy ap = new ApplicationPolicy(domain);
- ap.setRoleMappingInfo(rmi);
- return ap;
- }
-
- protected RoleMappingInfo createRoleMappingInfo(String domain)
- {
- RoleMappingInfo rmi = new RoleMappingInfo(domain);
- rmi.add(new MappingModuleEntry(this.mappingModule));
- return rmi;
- }
-
- protected RoleMappingInfo createRoleMappingInfo(String domain, List<String> moduleNames)
- {
- RoleMappingInfo rmi = new RoleMappingInfo(domain);
- for(String mod:moduleNames)
- {
- rmi.add(new MappingModuleEntry(mod));
- }
- return rmi;
- }
-}
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/SecurityContextBaseTest.java (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/java/org/jboss/test/securitycontext/SecurityContextBaseTest.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/SecurityContextBaseTest.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/java/org/jboss/test/securitycontext/SecurityContextBaseTest.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,114 @@
+/*
+ * 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.test.securitycontext;
+
+import java.security.Principal;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.config.ApplicationPolicy;
+import org.jboss.security.config.AttributeMappingInfo;
+import org.jboss.security.config.ModuleOption;
+import org.jboss.security.config.RoleMappingInfo;
+import org.jboss.security.config.SecurityConfiguration;
+import org.jboss.security.mapping.MappingType;
+import org.jboss.security.mapping.config.MappingModuleEntry;
+import org.jboss.security.mapping.providers.DeploymentRolesMappingProvider;
+import org.jboss.security.mapping.providers.attribute.DefaultAttributeMappingProvider;
+import org.jboss.security.plugins.JBossSecurityContext;
+
+//$Id$
+
+/**
+ * Base test class with common methods
+ * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ * @since Dec 26, 2006
+ * @version $Revision$
+ */
+public class SecurityContextBaseTest extends TestCase
+{
+ protected Principal principal = new SimplePrincipal("anil");
+ protected Object cred = "hello";
+ protected String securityDomain = "other";
+
+ private String roleMappingModule = DeploymentRolesMappingProvider.class.getName();
+ private String attrMappingModule = DefaultAttributeMappingProvider.class.getName();
+
+ public void testSecurityConfiguration()
+ {
+ ApplicationPolicy ap = createApplicationPolicy(securityDomain);
+ SecurityConfiguration.addApplicationPolicy(ap);
+ assertEquals(SecurityConfiguration.getApplicationPolicy(securityDomain), ap);
+ }
+
+ protected JBossSecurityContext getSC(String domain)
+ {
+ if(domain == null)
+ domain = securityDomain;
+ return new JBossSecurityContext(securityDomain);
+ }
+
+ protected ApplicationPolicy createApplicationPolicy(String domain)
+ {
+ ApplicationPolicy ap = new ApplicationPolicy(domain);
+ ap.setMappingInfo(MappingType.ROLE.name(), createRoleMappingInfo(domain));
+ ap.setMappingInfo(MappingType.ATTRIBUTE.name(), this.createAttributeMappingInfo(domain));
+ return ap;
+ }
+
+ protected ApplicationPolicy createApplicationPolicy(String domain, RoleMappingInfo rmi)
+ {
+ ApplicationPolicy ap = new ApplicationPolicy(domain);
+ ap.setMappingInfo(MappingType.ROLE.name(), rmi);
+ return ap;
+ }
+
+ protected RoleMappingInfo createRoleMappingInfo(String domain)
+ {
+ RoleMappingInfo rmi = new RoleMappingInfo(domain);
+ rmi.add(new MappingModuleEntry(this.roleMappingModule));
+ return rmi;
+ }
+
+ protected AttributeMappingInfo createAttributeMappingInfo(String domain)
+ {
+ AttributeMappingInfo rmi = new AttributeMappingInfo(domain);
+ MappingModuleEntry mme = new MappingModuleEntry(this.attrMappingModule);
+
+ ModuleOption option = new ModuleOption("anil.email", "anil at test");
+ mme.add(option);
+ rmi.add(mme);
+ return rmi;
+ }
+
+ protected RoleMappingInfo createRoleMappingInfo(String domain, List<String> moduleNames)
+ {
+ RoleMappingInfo rmi = new RoleMappingInfo(domain);
+ for(String mod:moduleNames)
+ {
+ rmi.add(new MappingModuleEntry(mod));
+ }
+ return rmi;
+ }
+}
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/resources/ldap/ldapAttributes.ldif (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/test/resources/ldap/ldapAttributes.ldif)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/resources/ldap/ldapAttributes.ldif (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx/src/test/resources/ldap/ldapAttributes.ldif 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,23 @@
+dn: dc=jboss,dc=org
+objectclass: dcObject
+objectclass: organization
+o: JBoss
+dc: JBoss
+
+dn: ou=People,dc=jboss,dc=org
+objectclass: top
+objectclass: organizationalUnit
+ou: People
+
+dn: uid=jduke,ou=People,dc=jboss,dc=org
+objectclass: top
+objectclass: uidObject
+objectclass: person
+objectclass: inetOrgPerson
+uid: jduke
+cn: Java Duke
+sn: Duke
+userPassword: theduke
+mail: theduke at somecastle.man
+employeeType: permanent
+employeeNumber: 007
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx-bridge-as4/pom.xml
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx-bridge-as4/pom.xml 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx-bridge-as4/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,62 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-parent</artifactId>
- <version>2.0.3.SP2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-bridge-as4</artifactId>
- <packaging>pom</packaging>
- <name>JBoss Security Implementation for the JBAS - Assembly build for AS 4.2.x</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss Inc.</name>
- <url>http://www.jboss.org</url>
- </organization>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.1</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <archive>
- <manifestEntries>
- <Specification-Title>JBoss Security Implementation for the JBAS</Specification-Title>
- <Specification-Version>${project.version}</Specification-Version>
- <Specification-Vendor>Red Hat Middleware LLC</Specification-Vendor>
- <Implementation-Title>JBoss Security Implementation for the JBAS</Implementation-Title>
- <Implementation-Version>${project.version}</Implementation-Version>
- <Implementation-VendorId>org.jboss.security</Implementation-VendorId>
- <Implementation-Vendor>Red Hat Middleware LLC</Implementation-Vendor>
- <Implementation-URL>http://labs.jboss.org/portal/jbosssecurity/</Implementation-URL>
- </manifestEntries>
- </archive>
- <descriptors>
- <descriptor>bin.xml</descriptor>
- <descriptor>sources.xml</descriptor>
- </descriptors>
- </configuration>
- <inherited>false</inherited>
- </plugin>
- </plugins>
- </build>
-
-</project>
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx-bridge-as4/pom.xml (from rev 92178, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx-bridge-as4/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx-bridge-as4/pom.xml (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx-bridge-as4/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,62 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-parent</artifactId>
+ <version>2.0.4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-bridge-as4</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Security Implementation for the JBAS - Assembly build for AS 4.2.x</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.1</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Specification-Title>JBoss Security Implementation for the JBAS</Specification-Title>
+ <Specification-Version>${project.version}</Specification-Version>
+ <Specification-Vendor>Red Hat Middleware LLC</Specification-Vendor>
+ <Implementation-Title>JBoss Security Implementation for the JBAS</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <Implementation-VendorId>org.jboss.security</Implementation-VendorId>
+ <Implementation-Vendor>Red Hat Middleware LLC</Implementation-Vendor>
+ <Implementation-URL>http://labs.jboss.org/portal/jbosssecurity/</Implementation-URL>
+ </manifestEntries>
+ </archive>
+ <descriptors>
+ <descriptor>bin.xml</descriptor>
+ <descriptor>sources.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <inherited>false</inherited>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx-client/pom.xml
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx-client/pom.xml 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx-client/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,75 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>3</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-client</artifactId>
- <version>2.0.3.SP2-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>JBoss Security Client</name>
- <url>http://www.jboss.org</url>
- <description>JBoss Security Client Library</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <archive>
- <manifest>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- <addDefaultSpecificationEntries />
- </manifest>
- </archive>
- <classesDirectory>../jbosssx/target/classes</classesDirectory>
- <includes>
- <include>JBossORG-EULA.txt</include>
- <include>org/jboss/crypto/JBossSXProvider.class</include>
- <include>org/jboss/crypto/CryptoUtil.class</include>
- <include>org/jboss/crypto/digest/*</include>
- <include>org/jboss/security/*</include>
- <include>org/jboss/security/auth/callback/*</include>
- <include>org/jboss/security/auth/login/*</include>
- <include>org/jboss/security/client/*</include>
- <include>org/jboss/security/auth/login/XMLLoginConfig.class</include>
- <include>org/jboss/security/auth/login/XMLLoginConfigMBean.class</include>
- <include>org/jboss/security/plugins/PBEUtils.class</include>
- <include>org/jboss/security/ssl/ClientSocketFactory.class</include>
- <include>org/jboss/security/ssl/RMISSLClientSocketFactory.class</include>
- <include>org/jboss/security/plugins/*SecurityContext*.class</include>
- <include>org/jboss/security/plugins/DefaultSecurityManagement.class</include>
- <include>org/jboss/resource/security/*.class</include> </includes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jboss-deploy-plugin</artifactId>
- <version>1.4</version>
- <executions>
- <execution>
- <id>jboss-deploy</id>
- <goals>
- <goal>jboss-deploy</goal>
- </goals>
- <phase>deploy</phase>
- </execution>
- </executions>
- <configuration>
- <groupId>jboss</groupId>
- <jbossDeployRoot>${jboss.repository.root}</jbossDeployRoot>
- <removeArtifactVersion>true</removeArtifactVersion>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx-client/pom.xml (from rev 92178, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx-client/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx-client/pom.xml (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx-client/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,75 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>3</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-client</artifactId>
+ <version>2.0.4</version>
+ <packaging>jar</packaging>
+ <name>JBoss Security Client</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss Security Client Library</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ <addDefaultSpecificationEntries />
+ </manifest>
+ </archive>
+ <classesDirectory>../jbosssx/target/classes</classesDirectory>
+ <includes>
+ <include>JBossORG-EULA.txt</include>
+ <include>org/jboss/crypto/JBossSXProvider.class</include>
+ <include>org/jboss/crypto/CryptoUtil.class</include>
+ <include>org/jboss/crypto/digest/*</include>
+ <include>org/jboss/security/*</include>
+ <include>org/jboss/security/auth/callback/*</include>
+ <include>org/jboss/security/auth/login/*</include>
+ <include>org/jboss/security/client/*</include>
+ <include>org/jboss/security/auth/login/XMLLoginConfig.class</include>
+ <include>org/jboss/security/auth/login/XMLLoginConfigMBean.class</include>
+ <include>org/jboss/security/plugins/PBEUtils.class</include>
+ <include>org/jboss/security/ssl/ClientSocketFactory.class</include>
+ <include>org/jboss/security/ssl/RMISSLClientSocketFactory.class</include>
+ <include>org/jboss/security/plugins/*SecurityContext*.class</include>
+ <include>org/jboss/security/plugins/DefaultSecurityManagement.class</include>
+ <include>org/jboss/resource/security/*.class</include> </includes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jboss-deploy-plugin</artifactId>
+ <version>1.4</version>
+ <executions>
+ <execution>
+ <id>jboss-deploy</id>
+ <goals>
+ <goal>jboss-deploy</goal>
+ </goals>
+ <phase>deploy</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <groupId>jboss</groupId>
+ <jbossDeployRoot>${jboss.repository.root}</jbossDeployRoot>
+ <removeArtifactVersion>true</removeArtifactVersion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/pom.xml
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx-mc-int/pom.xml 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,125 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-parent</artifactId>
- <version>2.0.3.SP2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>jbosssx-mc-int</artifactId>
- <packaging>jar</packaging>
- <name>JBoss Microcontainer Security Integration</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
-
- <build>
- <finalName>${artifactId}</finalName>
- </build>
-
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-bare</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jboss-security-spi</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- <version>2.0.6.GA</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-dependency</artifactId>
- <version>2.0.6.GA</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jbossxb</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-reflect</artifactId>
- <version>2.0.2.GA</version>
- <scope>runtime</scope>
- </dependency>
-
- <!-- Test dependencies -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-log4j</artifactId>
- <version>2.0.4.GA</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-spi</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jboss.profiler.jvmti</groupId>
- <artifactId>jboss-profiler-jvmti</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-</project>
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/pom.xml (from rev 92178, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx-mc-int/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/pom.xml (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,125 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-parent</artifactId>
+ <version>2.0.4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbosssx-mc-int</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Microcontainer Security Integration</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-bare</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-security-spi</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>2.0.6.GA</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ <version>2.0.6.GA</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-log4j</artifactId>
+ <version>2.0.4.GA</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss.profiler.jvmti</groupId>
+ <artifactId>jboss-profiler-jvmti</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+</project>
Deleted: projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/src/test/java/org/jboss/test/security/microcontainer/metadata/support/MockMappingManager.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx-mc-int/src/test/java/org/jboss/test/security/microcontainer/metadata/support/MockMappingManager.java 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/src/test/java/org/jboss/test/security/microcontainer/metadata/support/MockMappingManager.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,71 +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.test.security.microcontainer.metadata.support;
-
-import org.jboss.security.mapping.MappingContext;
-import org.jboss.security.mapping.MappingManager;
-
-/**
- * <p>
- * A mock {@code MappingManager} implementation used in the tests.
- * </p>
- *
- * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
- */
-public class MockMappingManager implements MappingManager
-{
-
- private final String domainName;
-
- /**
- * <p>
- * Creates an instance of {@code MockMappingManager} with the specified security domain name.
- * </p>
- *
- * @param domainName a {@code String} representing the name of the security domain.
- */
- public MockMappingManager(String domainName)
- {
- this.domainName = domainName;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.security.mapping.MappingManager#getMappingContext(java.lang.Class)
- */
- public <T> MappingContext<T> getMappingContext(Class<T> clazz)
- {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.security.BaseSecurityManager#getSecurityDomain()
- */
- public String getSecurityDomain()
- {
- return this.domainName;
- }
-
-}
Copied: projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/src/test/java/org/jboss/test/security/microcontainer/metadata/support/MockMappingManager.java (from rev 92039, projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx-mc-int/src/test/java/org/jboss/test/security/microcontainer/metadata/support/MockMappingManager.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/src/test/java/org/jboss/test/security/microcontainer/metadata/support/MockMappingManager.java (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/jbosssx-mc-int/src/test/java/org/jboss/test/security/microcontainer/metadata/support/MockMappingManager.java 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,81 @@
+/*
+ * 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.test.security.microcontainer.metadata.support;
+
+import org.jboss.security.mapping.MappingContext;
+import org.jboss.security.mapping.MappingManager;
+
+/**
+ * <p>
+ * A mock {@code MappingManager} implementation used in the tests.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+ */
+public class MockMappingManager implements MappingManager
+{
+
+ private final String domainName;
+
+ /**
+ * <p>
+ * Creates an instance of {@code MockMappingManager} with the specified security domain name.
+ * </p>
+ *
+ * @param domainName a {@code String} representing the name of the security domain.
+ */
+ public MockMappingManager(String domainName)
+ {
+ this.domainName = domainName;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.security.mapping.MappingManager#getMappingContext(java.lang.Class)
+ */
+ public <T> MappingContext<T> getMappingContext(Class<T> clazz)
+ {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.security.mapping.MappingManager#getMappingContext(java.lang.Class)
+ */
+ public <T> MappingContext<T> getMappingContext(String type)
+ {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.security.BaseSecurityManager#getSecurityDomain()
+ */
+ public String getSecurityDomain()
+ {
+ return this.domainName;
+ }
+
+}
Deleted: projects/security/security-jboss-sx/tags/2.0.4/parent/pom.xml
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/parent/pom.xml 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/parent/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,155 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>4</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-parent</artifactId>
- <packaging>pom</packaging>
- <version>2.0.3.SP2-SNAPSHOT</version>
- <name>JBossSX - Parent</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss Inc.</name>
- <url>http://www.jboss.org</url>
- </organization>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/branches/Branch_2_0</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/branches/Branch_2_0</developerConnection>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-6</version>
- <configuration>
- <tagBase>https://svn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/tags</tagBase>
- </configuration>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <printSummary>true</printSummary>
- <disableXmlReport>false</disableXmlReport>
- <testFailureIgnore>false</testFailureIgnore>
- <includes>
- <include>**/**TestCase.java</include>
- </includes>
- <forkMode>pertest</forkMode>
- <argLine>${surefire.jvm.args}</argLine>
- <useFile>false</useFile>
- <trimStackTrace>false</trimStackTrace>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
-
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <version>2.0.2.GA</version>
- <scope>runtime</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>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-jaspi-api</artifactId>
- <version>1.0.0.${org.jboss.javaee.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jboss-security-spi</artifactId>
- <version>${org.jboss.security.spi.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0.1</version>
- </dependency>
- <dependency>
- <groupId>sun-jaxb</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1.9</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>sun-jaxb</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.9</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-test</artifactId>
- <version>1.0.4.GA</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <properties>
- <org.jboss.javaee.version>GA</org.jboss.javaee.version>
- <org.jboss.security.spi.version>2.0.3.SP2</org.jboss.security.spi.version>
- </properties>
-</project>
Copied: projects/security/security-jboss-sx/tags/2.0.4/parent/pom.xml (from rev 92178, projects/security/security-jboss-sx/branches/Branch_2_0/parent/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/parent/pom.xml (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/parent/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,155 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-parent</artifactId>
+ <packaging>pom</packaging>
+ <version>2.0.4</version>
+ <name>JBossSX - Parent</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/tags/2.0.4</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/tags/2.0.4</developerConnection>
+ </scm>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-6</version>
+ <configuration>
+ <tagBase>https://svn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/tags</tagBase>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <printSummary>true</printSummary>
+ <disableXmlReport>false</disableXmlReport>
+ <testFailureIgnore>false</testFailureIgnore>
+ <includes>
+ <include>**/**TestCase.java</include>
+ </includes>
+ <forkMode>pertest</forkMode>
+ <argLine>${surefire.jvm.args}</argLine>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>runtime</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>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jaspi-api</artifactId>
+ <version>1.0.0.${org.jboss.javaee.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-security-spi</artifactId>
+ <version>${org.jboss.security.spi.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1.9</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.9</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>1.0.4.GA</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <properties>
+ <org.jboss.javaee.version>GA</org.jboss.javaee.version>
+ <org.jboss.security.spi.version>2.0.4</org.jboss.security.spi.version>
+ </properties>
+</project>
Deleted: projects/security/security-jboss-sx/tags/2.0.4/pom.xml
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/pom.xml 2009-07-21 21:59:08 UTC (rev 91524)
+++ projects/security/security-jboss-sx/tags/2.0.4/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -1,95 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>3</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx-pom</artifactId>
- <version>2.0.3.SP2-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>JBoss Security Implementation for the JBAS - Parent</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss Inc.</name>
- <url>http://www.jboss.org</url>
- </organization>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/branches/Branch_2_0</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/branches/Branch_2_0</developerConnection>
- </scm>
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
-
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
- <modules>
- <module>parent</module>
- <module>identity</module>
- <module>acl</module>
- <module>jbosssx</module>
- <module>jbosssx-client</module>
- <module>jbosssx-mc-int</module>
- <module>jbosssx-bridge-as4</module>
- <module>assembly</module>
- </modules>
-
- <profiles>
- <!-- Specify heap size for ACL tests -->
- <profile>
- <id>acl-heap-profile</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <properties>
- <surefire.jvm.args>-Xms512m -Xmx1024m</surefire.jvm.args>
- </properties>
- <modules>
- <module>acl</module>
- </modules>
- </profile>
- </profiles>
-
- <distributionManagement>
- <repository>
- <!-- Copy the distribution jar file to a local checkout of the maven repositry
- - This variable can be set in $MAVEN_HOME/conf/settings.xml -->
- <id>repository.jboss.org</id>
- <url>file://${maven.repository.root}</url>
- </repository>
- <snapshotRepository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Inc. Repository</name>
- <layout>default</layout>
- <url>dav:https://snapshots.jboss.org/maven2/</url>
- </snapshotRepository>
- </distributionManagement>
-</project>
Copied: projects/security/security-jboss-sx/tags/2.0.4/pom.xml (from rev 92178, projects/security/security-jboss-sx/branches/Branch_2_0/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.4/pom.xml (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.4/pom.xml 2009-08-10 04:26:43 UTC (rev 92179)
@@ -0,0 +1,95 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>3</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx-pom</artifactId>
+ <version>2.0.4</version>
+ <packaging>pom</packaging>
+ <name>JBoss Security Implementation for the JBAS - Parent</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Security is a cross cutting project that handles security for the JEMS projects</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/tags/2.0.4</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/tags/2.0.4</developerConnection>
+ </scm>
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>parent</module>
+ <module>identity</module>
+ <module>acl</module>
+ <module>jbosssx</module>
+ <module>jbosssx-client</module>
+ <module>jbosssx-mc-int</module>
+ <module>jbosssx-bridge-as4</module>
+ <module>assembly</module>
+ </modules>
+
+ <profiles>
+ <!-- Specify heap size for ACL tests -->
+ <profile>
+ <id>acl-heap-profile</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <surefire.jvm.args>-Xms512m -Xmx1024m</surefire.jvm.args>
+ </properties>
+ <modules>
+ <module>acl</module>
+ </modules>
+ </profile>
+ </profiles>
+
+ <distributionManagement>
+ <repository>
+ <!-- Copy the distribution jar file to a local checkout of the maven repositry
+ - This variable can be set in $MAVEN_HOME/conf/settings.xml -->
+ <id>repository.jboss.org</id>
+ <url>file://${maven.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Inc. Repository</name>
+ <layout>default</layout>
+ <url>dav:https://snapshots.jboss.org/maven2/</url>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
More information about the jboss-cvs-commits
mailing list