[jboss-cvs] JBossAS SVN: r68974 - in projects/security/security-jboss-sx/tags: 2.0.2.Beta4 and 16 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 15 00:53:50 EST 2008


Author: anil.saldhana at jboss.com
Date: 2008-01-15 00:53:49 -0500 (Tue, 15 Jan 2008)
New Revision: 68974

Added:
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/README
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/docs/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/main/org/jboss/security/identity/plugins/SimpleRoleGroup.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/tests/org/jboss/test/identity/impl/RoleUnitTestCase.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/CryptoUtil.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/digest/DigestCallback.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AnybodyPrincipal.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AuthorizationInfo.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/ClientLoginModule.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestableGroup.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestablePrincipal.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NobodyPrincipal.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/RunAsIdentity.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/SecurityActions.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/audit/config/AuditConfigEntryHolder.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/AppCallbackHandler.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/CallbackHandlerPolicyContextHandler.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/MapCallback.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityActions.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityAssociationHandler.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/MappingProviderUtil.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/OptionsRoleMappingProvider.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PolicyContextIdRoleMappingProvider.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PrincipalToRoleMappingProvider.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/SecurityActions.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/plugins/FilePassword.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/tests/org/jboss/test/security/mapping/DeploymentRolesMappingUnitTestCase.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/pom.xml
Removed:
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/README
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/docs/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/main/org/jboss/security/identity/plugins/SimpleRoleGroup.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/tests/org/jboss/test/identity/impl/RoleUnitTestCase.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/pom.xml
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/CryptoUtil.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/digest/DigestCallback.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AnybodyPrincipal.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AuthorizationInfo.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/ClientLoginModule.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestableGroup.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestablePrincipal.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NobodyPrincipal.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/RunAsIdentity.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/SecurityActions.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/audit/config/AuditConfigEntryHolder.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/AppCallbackHandler.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/CallbackHandlerPolicyContextHandler.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/MapCallback.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityActions.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityAssociationHandler.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/MappingProviderUtil.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/OptionsRoleMappingProvider.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PolicyContextIdRoleMappingProvider.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PrincipalToRoleMappingProvider.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/SecurityActions.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/plugins/FilePassword.java
   projects/security/security-jboss-sx/tags/2.0.2.Beta4/pom.xml
Log:
[maven-release-plugin]  copy for tag 2.0.2.Beta4

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4 (from rev 68789, projects/security/security-jboss-sx/trunk)

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/README
===================================================================
--- projects/security/security-jboss-sx/trunk/README	2008-01-10 05:42:24 UTC (rev 68789)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/README	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,26 +0,0 @@
-Constituents:
-===============
-pom.xml  - Aggregator POM
-acl - ACL Implementation
-docs - Docbook module 
-identity - Identity API implementation 
-jbosssx  - Default implementation of the JBoss Security SPI 
-jbosssx-client  - Submodule that jars up a client jar 
-
-To Build the Overall Artifact:
-=============================
-trunk>  mvn install 
-Note that the mvn install command will scroll pages on your terminal. Hence it is better to do
-mvn install 2>&1 >somefile
-
-Then you open the "somefile" to see how the tests have fared
-
-To Build the artifacts for individual projects:
-==============================================
-Do "mvn install"
-
-Deploy The Artifacts:
-====================
-mvn deploy
-
-Remember: You will need to set up the settings.xml in your maven directory for the artifacts to be transferred to JBAS svn repository.

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/README (from rev 68788, projects/security/security-jboss-sx/trunk/README)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/README	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/README	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,26 @@
+Constituents:
+===============
+pom.xml  - Aggregator POM
+acl - ACL Implementation
+docs - Docbook module 
+identity - Identity API implementation 
+jbosssx  - Default implementation of the JBoss Security SPI 
+jbosssx-client  - Submodule that jars up a client jar 
+
+To Build the Overall Artifact:
+=============================
+trunk>  mvn install 
+Note that the mvn install command will scroll pages on your terminal. Hence it is better to do
+mvn install 2>&1 >somefile
+
+Then you open the "somefile" to see how the tests have fared
+
+To Build the artifacts for individual projects:
+==============================================
+Do "mvn install"
+
+Deploy The Artifacts:
+====================
+mvn deploy
+
+Remember: You will need to set up the settings.xml in your maven directory for the artifacts to be transferred to JBAS svn repository.

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl (from rev 68788, projects/security/security-jboss-sx/trunk/acl)

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl/pom.xml
===================================================================
--- projects/security/security-jboss-sx/trunk/acl/pom.xml	2008-01-10 05:29:26 UTC (rev 68788)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,138 +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.2-SNAPSHOT</version>
-   </parent>
-   <modelVersion>4.0.0</modelVersion>
-   <artifactId>jboss-security-acl</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</sourceDirectory>
-      <testSourceDirectory>src/tests</testSourceDirectory>
-      <testOutputDirectory>target/test-classes</testOutputDirectory>
-      <finalName>${artifactId}</finalName>
-      <outputDirectory>target/classes</outputDirectory>
-      <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>
-         <resource>
-            <directory>target/generated-sources/javacc</directory>
-            <includes>
-               <include>**/*.class</include>
-            </includes>
-         </resource> 
-      </resources> 
-      <testResources>
-         <testResource>
-            <directory>src/tests/resources/</directory>
-         </testResource>
-         <testResource>
-            <directory>src/main</directory>
-         </testResource>
-      </testResources>
-   </build>
-   <dependencies> 
-      <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>acl-spi</artifactId>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>identity-spi</artifactId>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss</groupId>
-         <artifactId>jboss-common-core</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>jboss</groupId>
-         <artifactId>jboss-logging-spi</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>jboss</groupId>
-         <artifactId>jboss-logging-log4j</artifactId>
-         <scope>runtime</scope>
-      </dependency>
-      <dependency>
-         <groupId>apache-log4j</groupId>
-         <artifactId>log4j</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>junit</groupId>
-         <artifactId>junit</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss</groupId>
-         <artifactId>jboss-test</artifactId>
-         <scope>test</scope>
-      </dependency>    
-      <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>identity-impl</artifactId>
-         <version>2.0.2-SNAPSHOT</version>
-         <scope>test</scope>
-      </dependency>    
-   </dependencies>
-</project>

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl/pom.xml (from rev 68973, projects/security/security-jboss-sx/trunk/acl/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl/pom.xml	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/acl/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,138 @@
+<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.2.Beta4</version>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>jboss-security-acl</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</sourceDirectory>
+      <testSourceDirectory>src/tests</testSourceDirectory>
+      <testOutputDirectory>target/test-classes</testOutputDirectory>
+      <finalName>${artifactId}</finalName>
+      <outputDirectory>target/classes</outputDirectory>
+      <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>
+         <resource>
+            <directory>target/generated-sources/javacc</directory>
+            <includes>
+               <include>**/*.class</include>
+            </includes>
+         </resource> 
+      </resources> 
+      <testResources>
+         <testResource>
+            <directory>src/tests/resources/</directory>
+         </testResource>
+         <testResource>
+            <directory>src/main</directory>
+         </testResource>
+      </testResources>
+   </build>
+   <dependencies> 
+      <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>acl-spi</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>identity-spi</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss</groupId>
+         <artifactId>jboss-common-core</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>jboss</groupId>
+         <artifactId>jboss-logging-spi</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>jboss</groupId>
+         <artifactId>jboss-logging-log4j</artifactId>
+         <scope>runtime</scope>
+      </dependency>
+      <dependency>
+         <groupId>apache-log4j</groupId>
+         <artifactId>log4j</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss</groupId>
+         <artifactId>jboss-test</artifactId>
+         <scope>test</scope>
+      </dependency>    
+      <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>identity-impl</artifactId>
+         <version>2.0.2.Beta4</version>
+         <scope>test</scope>
+      </dependency>    
+   </dependencies>
+</project>

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly (from rev 68788, projects/security/security-jboss-sx/trunk/assembly)

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly/pom.xml
===================================================================
--- projects/security/security-jboss-sx/trunk/assembly/pom.xml	2008-01-10 05:29:26 UTC (rev 68788)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -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.2-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>
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly/pom.xml (from rev 68973, projects/security/security-jboss-sx/trunk/assembly/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly/pom.xml	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/assembly/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -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.2.Beta4</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>
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/docs (from rev 68788, projects/security/security-jboss-sx/trunk/docs)

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity (from rev 68788, projects/security/security-jboss-sx/trunk/identity)

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/pom.xml
===================================================================
--- projects/security/security-jboss-sx/trunk/identity/pom.xml	2008-01-10 05:29:26 UTC (rev 68788)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,130 +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.2-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>
-      <sourceDirectory>src/main</sourceDirectory>
-      <testSourceDirectory>src/tests</testSourceDirectory>
-      <testOutputDirectory>target/test-classes</testOutputDirectory>
-      <finalName>${artifactId}</finalName>
-      <outputDirectory>target/classes</outputDirectory>
-      <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> 
-      <testResources>
-         <testResource>
-            <directory>src/tests/resources/</directory>
-         </testResource>
-         <testResource>
-            <directory>src/main</directory>
-         </testResource>
-      </testResources>
-   </build>
-   <dependencies> 
-      <dependency>
-         <groupId>org.jboss</groupId>
-         <artifactId>jboss-common-core</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>jboss</groupId>
-         <artifactId>jboss-logging-spi</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>jboss</groupId>
-         <artifactId>jboss-logging-log4j</artifactId>
-         <scope>runtime</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.jboss.security</groupId>
-        <artifactId>identity-spi</artifactId>
-      </dependency>
-<!--
-      <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>jboss-security-spi</artifactId>
-         <version>2.0.2.alpha1</version>
-         <scope>compile</scope>
-      </dependency>
--->
-      <dependency>
-         <groupId>apache-log4j</groupId>
-         <artifactId>log4j</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>junit</groupId>
-         <artifactId>junit</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss</groupId>
-         <artifactId>jboss-test</artifactId>
-         <scope>test</scope>
-      </dependency>    
-   </dependencies>
-</project>

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/pom.xml (from rev 68973, projects/security/security-jboss-sx/trunk/identity/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/pom.xml	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,130 @@
+<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.2.Beta4</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>
+      <sourceDirectory>src/main</sourceDirectory>
+      <testSourceDirectory>src/tests</testSourceDirectory>
+      <testOutputDirectory>target/test-classes</testOutputDirectory>
+      <finalName>${artifactId}</finalName>
+      <outputDirectory>target/classes</outputDirectory>
+      <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> 
+      <testResources>
+         <testResource>
+            <directory>src/tests/resources/</directory>
+         </testResource>
+         <testResource>
+            <directory>src/main</directory>
+         </testResource>
+      </testResources>
+   </build>
+   <dependencies> 
+      <dependency>
+         <groupId>org.jboss</groupId>
+         <artifactId>jboss-common-core</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>jboss</groupId>
+         <artifactId>jboss-logging-spi</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>jboss</groupId>
+         <artifactId>jboss-logging-log4j</artifactId>
+         <scope>runtime</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.security</groupId>
+        <artifactId>identity-spi</artifactId>
+      </dependency>
+<!--
+      <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>jboss-security-spi</artifactId>
+         <version>2.0.2.alpha1</version>
+         <scope>compile</scope>
+      </dependency>
+-->
+      <dependency>
+         <groupId>apache-log4j</groupId>
+         <artifactId>log4j</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss</groupId>
+         <artifactId>jboss-test</artifactId>
+         <scope>test</scope>
+      </dependency>    
+   </dependencies>
+</project>

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/main/org/jboss/security/identity/plugins/SimpleRoleGroup.java
===================================================================
--- projects/security/security-jboss-sx/trunk/identity/src/main/org/jboss/security/identity/plugins/SimpleRoleGroup.java	2008-01-10 05:29:26 UTC (rev 68788)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/main/org/jboss/security/identity/plugins/SimpleRoleGroup.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,173 +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.identity.plugins;
-
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.security.identity.Role;
-import org.jboss.security.identity.RoleGroup;
-import org.jboss.security.identity.RoleType;
-
-//$Id$
-
-/**
- *  Simple Role Group
- *  @author Anil.Saldhana at redhat.com
- *  @since  Nov 16, 2007 
- *  @version $Revision$
- */
-public class SimpleRoleGroup extends SimpleRole implements RoleGroup
-{
-   private static final long serialVersionUID = 1L;
-   private ArrayList<Role> roles = new ArrayList<Role>();
-   private static final String ROLES_IDENTIFIER = "Roles";
-   
-   public SimpleRoleGroup(String roleName)
-   {
-      super(roleName); 
-   }
-
-   public SimpleRoleGroup(String roleName, List<Role> roles)
-   {
-      super(roleName); 
-      if(this.roles == null)
-         this.roles = new ArrayList<Role>();
-      this.roles.addAll(roles);
-   }
-   
-   public SimpleRoleGroup(Group rolesGroup)
-   {
-     super(rolesGroup.getName());
-     Enumeration<? extends Principal> principals = rolesGroup.members();
-     while(principals.hasMoreElements())
-     {
-        roles.add(new SimpleRole(principals.nextElement().getName()));
-     }
-   }
-   
-   public SimpleRoleGroup(Set<Principal> rolesAsPrincipals)
-   {
-      super(ROLES_IDENTIFIER);
-      for(Principal p: rolesAsPrincipals)
-      {
-         roles.add(new SimpleRole(p.getName()));  
-      }     
-   }
-   
-   @Override
-   public RoleType getType()
-   {
-      return RoleType.group;
-   }
-
-   public List<Role> getRoles()
-   {
-      return roles;
-   }
-   
-   @SuppressWarnings("unchecked")
-   public synchronized Object clone() throws CloneNotSupportedException  
-   {  
-      SimpleRoleGroup clone = (SimpleRoleGroup) super.clone();  
-      if(clone != null) 
-        clone.roles = (ArrayList<Role>)this.roles.clone();   
-      return clone;  
-   }
-
-   @Override
-   public boolean containsAll(Role anotherRole)
-   {
-      boolean isContained = false;
-      
-      if(anotherRole.getType() == RoleType.simple)
-      {
-         for(Role r: roles)
-         {
-            isContained = r.containsAll(anotherRole);
-            if(isContained)
-               return true;
-         } 
-      }
-      else
-      {
-         //Dealing with another roleGroup
-         RoleGroup anotherRG = (RoleGroup) anotherRole;
-         List<Role> anotherRoles = anotherRG.getRoles();
-         for(Role r: anotherRoles)
-         {
-            //if any of the roles are not there, no point checking further
-            if(!this.containsAll(r)) 
-               return false;
-         }
-         return true;
-      }
-      return false;
-   }
-
-   /**
-    * @see RoleGroup#containsAtleastOneRole(RoleGroup)
-    */
-   public boolean containsAtleastOneRole(RoleGroup anotherRole)
-   { 
-      if(anotherRole == null)
-         throw new IllegalArgumentException("anotherRole is null");
-      List<Role> roleList = anotherRole.getRoles();
-      for(Role r: roleList)
-      {
-         if(this.containsAll(r))
-            return true;
-      }
-      return false;
-   }
-    
-   /**
-    * @see RoleGroup#containsRole(Role)
-    */
-   public boolean containsRole(Role role)
-   {
-      for(Role r: roles)
-      {
-         if(r.containsAll(role))
-            return true;
-      }
-      return false;
-   } 
-
-   @Override
-   public String toString()
-   {
-      StringBuilder builder = new StringBuilder();
-      builder.append(this.getRoleName());
-      builder.append("(");
-      for(Role role: roles)
-      { 
-         builder.append(role.toString()).append(",");
-      }
-      builder.append(")"); 
-      return builder.toString();
-   } 
-}
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/main/org/jboss/security/identity/plugins/SimpleRoleGroup.java (from rev 68963, projects/security/security-jboss-sx/trunk/identity/src/main/org/jboss/security/identity/plugins/SimpleRoleGroup.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/main/org/jboss/security/identity/plugins/SimpleRoleGroup.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/main/org/jboss/security/identity/plugins/SimpleRoleGroup.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,184 @@
+/*
+  * 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.identity.plugins;
+
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.security.identity.Role;
+import org.jboss.security.identity.RoleGroup;
+import org.jboss.security.identity.RoleType;
+
+//$Id$
+
+/**
+ *  Simple Role Group
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Nov 16, 2007 
+ *  @version $Revision$
+ */
+public class SimpleRoleGroup extends SimpleRole implements RoleGroup
+{
+   private static final long serialVersionUID = 1L;
+   private ArrayList<Role> roles = new ArrayList<Role>();
+   private static final String ROLES_IDENTIFIER = "Roles";
+   
+   public SimpleRoleGroup(String roleName)
+   {
+      super(roleName); 
+   }
+
+   public SimpleRoleGroup(String roleName, List<Role> roles)
+   {
+      super(roleName); 
+      if(this.roles == null)
+         this.roles = new ArrayList<Role>();
+      this.roles.addAll(roles);
+   }
+   
+   public SimpleRoleGroup(Group rolesGroup)
+   {
+     super(rolesGroup.getName());
+     Enumeration<? extends Principal> principals = rolesGroup.members();
+     while(principals.hasMoreElements())
+     {
+        roles.add(new SimpleRole(principals.nextElement().getName()));
+     }
+   }
+   
+   public SimpleRoleGroup(Set<Principal> rolesAsPrincipals)
+   {
+      super(ROLES_IDENTIFIER);
+      for(Principal p: rolesAsPrincipals)
+      {
+         roles.add(new SimpleRole(p.getName()));  
+      }     
+   }
+   
+   @Override
+   public RoleType getType()
+   {
+      return RoleType.group;
+   }
+
+   /**
+    * @see RoleGroup#addRole(Role)
+    */
+   public void addRole(Role role)
+   {
+      this.roles.add(role);  
+   }
+
+   /**
+    * @see RoleGroup#getRoles()
+    */
+   public List<Role> getRoles()
+   {
+      return roles;
+   }
+   
+   @SuppressWarnings("unchecked")
+   public synchronized Object clone() throws CloneNotSupportedException  
+   {  
+      SimpleRoleGroup clone = (SimpleRoleGroup) super.clone();  
+      if(clone != null) 
+        clone.roles = (ArrayList<Role>)this.roles.clone();   
+      return clone;  
+   }
+
+   @Override
+   public boolean containsAll(Role anotherRole)
+   {
+      boolean isContained = false;
+      
+      if(anotherRole.getType() == RoleType.simple)
+      {
+         for(Role r: roles)
+         {
+            isContained = r.containsAll(anotherRole);
+            if(isContained)
+               return true;
+         } 
+      }
+      else
+      {
+         //Dealing with another roleGroup
+         RoleGroup anotherRG = (RoleGroup) anotherRole;
+         List<Role> anotherRoles = anotherRG.getRoles();
+         for(Role r: anotherRoles)
+         {
+            //if any of the roles are not there, no point checking further
+            if(!this.containsAll(r)) 
+               return false;
+         }
+         return true;
+      }
+      return false;
+   }
+
+   /**
+    * @see RoleGroup#containsAtleastOneRole(RoleGroup)
+    */
+   public boolean containsAtleastOneRole(RoleGroup anotherRole)
+   { 
+      if(anotherRole == null)
+         throw new IllegalArgumentException("anotherRole is null");
+      List<Role> roleList = anotherRole.getRoles();
+      for(Role r: roleList)
+      {
+         if(this.containsAll(r))
+            return true;
+      }
+      return false;
+   }
+    
+   /**
+    * @see RoleGroup#containsRole(Role)
+    */
+   public boolean containsRole(Role role)
+   {
+      for(Role r: roles)
+      {
+         if(r.containsAll(role))
+            return true;
+      }
+      return false;
+   } 
+
+   @Override
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(this.getRoleName());
+      builder.append("(");
+      for(Role role: roles)
+      { 
+         builder.append(role.toString()).append(",");
+      }
+      builder.append(")"); 
+      return builder.toString();
+   } 
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/tests/org/jboss/test/identity/impl/RoleUnitTestCase.java
===================================================================
--- projects/security/security-jboss-sx/trunk/identity/src/tests/org/jboss/test/identity/impl/RoleUnitTestCase.java	2008-01-10 05:29:26 UTC (rev 68788)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/tests/org/jboss/test/identity/impl/RoleUnitTestCase.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,77 +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.identity.impl;
-
-import junit.framework.TestCase;
-
-import org.jboss.security.identity.Role;
-import org.jboss.security.identity.RoleFactory;
-import org.jboss.security.identity.plugins.SimpleRole;
-import org.jboss.security.identity.plugins.SimpleRoleGroup;
-
-//$Id$
-
-/**
- *  Tests for the Role classes
- *  @author Anil.Saldhana at redhat.com
- *  @since  Dec 20, 2007 
- *  @version $Revision$
- */
-public class RoleUnitTestCase extends TestCase
-{
-   public void testRoleFactory() throws Exception
-   {
-      RoleFactory.SIMPLE_ROLE_CLASS = SimpleRole.class.getName();
-      RoleFactory.SIMPLE_ROLEGROUP_CLASS = SimpleRoleGroup.class.getName();
-      assertTrue(RoleFactory.createRole("myRole") instanceof SimpleRole);
-      assertTrue(RoleFactory.createRoleGroup("myRoleGroup") instanceof SimpleRoleGroup);      
-   }
-   
-   public void testSimpleRoleContains() throws Exception
-   {
-      Role firstRole = new SimpleRole("A");
-      Role secondRole = new SimpleRole("B");
-      
-      assertTrue(firstRole.containsAll(firstRole));
-      assertFalse(firstRole.containsAll(secondRole));
-      assertFalse(secondRole.containsAll(firstRole));
-   } 
-   
-   public void testSimpleRoleGroupContains() throws Exception
-   {
-      SimpleRoleGroup firstRoleGroup = new SimpleRoleGroup("firstrg");
-      firstRoleGroup.getRoles().add(new SimpleRole("A"));
-      firstRoleGroup.getRoles().add(new SimpleRole("B"));
-      firstRoleGroup.getRoles().add(new SimpleRole("C"));
-      
-      SimpleRoleGroup secondRoleGroup = new SimpleRoleGroup("secondrg");
-      secondRoleGroup.getRoles().add(new SimpleRole("A"));
-      secondRoleGroup.getRoles().add(new SimpleRole("B"));
-      
-      assertTrue(firstRoleGroup.containsAll(firstRoleGroup));
-      assertTrue(secondRoleGroup.containsAll(secondRoleGroup));
-      assertTrue(firstRoleGroup.containsAll(secondRoleGroup));
-      assertFalse(secondRoleGroup.containsAll(firstRoleGroup));
-      
-      assertTrue(firstRoleGroup.containsAtleastOneRole(secondRoleGroup));
-   }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/tests/org/jboss/test/identity/impl/RoleUnitTestCase.java (from rev 68963, projects/security/security-jboss-sx/trunk/identity/src/tests/org/jboss/test/identity/impl/RoleUnitTestCase.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/tests/org/jboss/test/identity/impl/RoleUnitTestCase.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/identity/src/tests/org/jboss/test/identity/impl/RoleUnitTestCase.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,85 @@
+/*
+  * 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.identity.impl;
+
+import junit.framework.TestCase;
+
+import org.jboss.security.identity.Role;
+import org.jboss.security.identity.RoleFactory;
+import org.jboss.security.identity.plugins.SimpleRole;
+import org.jboss.security.identity.plugins.SimpleRoleGroup;
+ 
+
+//$Id$
+
+/**
+ *  Tests for the Role classes
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Dec 20, 2007 
+ *  @version $Revision$
+ */
+public class RoleUnitTestCase extends TestCase
+{
+   public void testRoleFactory() throws Exception
+   {
+      RoleFactory.SIMPLE_ROLE_CLASS = SimpleRole.class.getName();
+      RoleFactory.SIMPLE_ROLEGROUP_CLASS = SimpleRoleGroup.class.getName();
+      assertTrue(RoleFactory.createRole("myRole") instanceof SimpleRole);
+      assertTrue(RoleFactory.createRoleGroup("myRoleGroup") instanceof SimpleRoleGroup);      
+   }
+   
+   public void testSimpleRoleContains() throws Exception
+   {
+      Role firstRole = new SimpleRole("A");
+      Role secondRole = new SimpleRole("B");
+      
+      assertTrue(firstRole.containsAll(firstRole));
+      assertFalse(firstRole.containsAll(secondRole));
+      assertFalse(secondRole.containsAll(firstRole));
+   } 
+   
+   public void testSimpleRoleGroupContains() throws Exception
+   {
+      SimpleRoleGroup firstRoleGroup = new SimpleRoleGroup("firstrg");
+      firstRoleGroup.getRoles().add(new SimpleRole("A"));
+      firstRoleGroup.getRoles().add(new SimpleRole("B"));
+      firstRoleGroup.getRoles().add(new SimpleRole("C"));
+      
+      SimpleRoleGroup secondRoleGroup = new SimpleRoleGroup("secondrg");
+      secondRoleGroup.getRoles().add(new SimpleRole("A"));
+      secondRoleGroup.getRoles().add(new SimpleRole("B"));
+      
+      assertTrue(firstRoleGroup.containsAll(firstRoleGroup));
+      assertTrue(secondRoleGroup.containsAll(secondRoleGroup));
+      assertTrue(firstRoleGroup.containsAll(secondRoleGroup));
+      assertFalse(secondRoleGroup.containsAll(firstRoleGroup));
+      
+      assertTrue(firstRoleGroup.containsAtleastOneRole(secondRoleGroup));
+   }
+   
+   public void testSimpleRoleGroup()
+   {
+      SimpleRoleGroup srg = new SimpleRoleGroup("Roles");
+      srg.addRole(new SimpleRole("aRole"));
+      assertTrue(srg.containsAll(new SimpleRole("aRole"))); 
+   }
+}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx (from rev 68788, projects/security/security-jboss-sx/trunk/jbosssx)

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/pom.xml
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/pom.xml	2008-01-10 05:29:26 UTC (rev 68788)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,205 +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.2-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=failure,access ${test.env}</surefire.jvm.args>
-      </properties>
-    </profile>
-   </profiles>
-   <build>
-      <sourceDirectory>src/main</sourceDirectory>
-      <testSourceDirectory>src/tests</testSourceDirectory>
-      <testOutputDirectory>target/test-classes</testOutputDirectory>
-      <finalName>${artifactId}</finalName>
-      <outputDirectory>target/classes</outputDirectory>
-      <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>
-         <resource>
-            <directory>target/generated-sources/javacc</directory>
-            <includes>
-               <include>**/*.class</include>
-            </includes>
-         </resource> 
-      </resources> 
-      <testResources>
-         <testResource>
-            <directory>src/tests/resources/</directory>
-         </testResource>
-         <testResource>
-            <directory>src/main</directory>
-         </testResource>
-      </testResources>
-      <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</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-jacc-api</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.javaee</groupId>
-         <artifactId>jboss-transaction-api</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.javaee</groupId>
-         <artifactId>jboss-jaspi-api</artifactId>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss</groupId>
-         <artifactId>jbossxb</artifactId>
-         <version>2.0.0.CR4</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>identity-impl</artifactId>
-         <version>2.0.2-SNAPSHOT</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>javassist</groupId>
-         <artifactId>javassist</artifactId>
-         <version>3.4.GA</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>sun-xacml</groupId>
-         <artifactId>sun-xacml</artifactId>
-         <version>2.0</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>sun-xacml</groupId>
-         <artifactId>sunxacml-support</artifactId>
-         <version>2.0</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>javax.servlet</groupId>
-         <artifactId>servlet-api</artifactId>
-         <version>2.5</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>javax.mail</groupId>
-         <artifactId>mail</artifactId>
-         <version>1.4</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>apache-xerces</groupId>
-         <artifactId>xercesImpl</artifactId>
-         <version>2.7.1</version>
-         <scope>test</scope>
-      </dependency> 
-      <dependency>
-         <groupId>org.jboss</groupId>
-         <artifactId>jnpserver</artifactId>
-         <version>5.0.0.Beta3</version>
-         <scope>test</scope>
-      </dependency>    
-      <dependency>
-         <groupId>org.jboss</groupId>
-         <artifactId>jboss-test</artifactId>
-         <scope>test</scope>
-      </dependency>    
-      <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>jboss-security-spi-bare</artifactId>
-      </dependency>
-      <dependency>
-         <groupId>sun-opends</groupId>
-         <artifactId>opends-core</artifactId>
-         <version>1.0.0-BUILD04</version>
-         <scope>test</scope>
-      </dependency>    
-      <dependency>
-         <groupId>sleepycat</groupId>
-         <artifactId>je</artifactId>
-         <version>3.2.43</version>
-         <scope>test</scope>
-      </dependency>    
-   </dependencies>
-</project>
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/pom.xml (from rev 68973, projects/security/security-jboss-sx/trunk/jbosssx/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/pom.xml	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,205 @@
+<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.2.Beta4</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=failure,access ${test.env}</surefire.jvm.args>
+      </properties>
+    </profile>
+   </profiles>
+   <build>
+      <sourceDirectory>src/main</sourceDirectory>
+      <testSourceDirectory>src/tests</testSourceDirectory>
+      <testOutputDirectory>target/test-classes</testOutputDirectory>
+      <finalName>${artifactId}</finalName>
+      <outputDirectory>target/classes</outputDirectory>
+      <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>
+         <resource>
+            <directory>target/generated-sources/javacc</directory>
+            <includes>
+               <include>**/*.class</include>
+            </includes>
+         </resource> 
+      </resources> 
+      <testResources>
+         <testResource>
+            <directory>src/tests/resources/</directory>
+         </testResource>
+         <testResource>
+            <directory>src/main</directory>
+         </testResource>
+      </testResources>
+      <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</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-jacc-api</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.javaee</groupId>
+         <artifactId>jboss-transaction-api</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.javaee</groupId>
+         <artifactId>jboss-jaspi-api</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss</groupId>
+         <artifactId>jbossxb</artifactId>
+         <version>2.0.0.CR4</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>identity-impl</artifactId>
+         <version>2.0.2.Beta4</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>javassist</groupId>
+         <artifactId>javassist</artifactId>
+         <version>3.4.GA</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>sun-xacml</groupId>
+         <artifactId>sun-xacml</artifactId>
+         <version>2.0</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>sun-xacml</groupId>
+         <artifactId>sunxacml-support</artifactId>
+         <version>2.0</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>javax.servlet</groupId>
+         <artifactId>servlet-api</artifactId>
+         <version>2.5</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>javax.mail</groupId>
+         <artifactId>mail</artifactId>
+         <version>1.4</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>apache-xerces</groupId>
+         <artifactId>xercesImpl</artifactId>
+         <version>2.7.1</version>
+         <scope>test</scope>
+      </dependency> 
+      <dependency>
+         <groupId>org.jboss</groupId>
+         <artifactId>jnpserver</artifactId>
+         <version>5.0.0.Beta3</version>
+         <scope>test</scope>
+      </dependency>    
+      <dependency>
+         <groupId>org.jboss</groupId>
+         <artifactId>jboss-test</artifactId>
+         <scope>test</scope>
+      </dependency>    
+      <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>jboss-security-spi-bare</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>sun-opends</groupId>
+         <artifactId>opends-core</artifactId>
+         <version>1.0.0-BUILD04</version>
+         <scope>test</scope>
+      </dependency>    
+      <dependency>
+         <groupId>sleepycat</groupId>
+         <artifactId>je</artifactId>
+         <version>3.2.43</version>
+         <scope>test</scope>
+      </dependency>    
+   </dependencies>
+</project>
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/CryptoUtil.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/crypto/CryptoUtil.java	2008-01-10 05:29:26 UTC (rev 68788)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/CryptoUtil.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,598 +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.crypto;
-
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.math.BigInteger;
-import java.security.GeneralSecurityException;
-import java.security.KeyException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.Provider;
-import java.security.SecureRandom;
-import java.security.Security;
-import java.util.Random;
-
-import org.jboss.crypto.digest.DigestCallback;
-import org.jboss.logging.Logger;
-import org.jboss.security.Base64Encoder;
-import org.jboss.security.Base64Utils;
-
-/** Various security related utilities like MessageDigest
- factories, SecureRandom access, password hashing.
-
- This product includes software developed by Tom Wu and Eugene
- Jhong for the SRP Distribution (http://srp.stanford.edu/srp/).
-
- @author Scott.Stark at jboss.org
- @version $Revision: 62650 $
- */
-public class CryptoUtil
-{
-   private static Logger log = Logger.getLogger(CryptoUtil.class);
-   private static final int HASH_LEN = 20;
-   public static final String BASE64_ENCODING = "BASE64";
-   public static final String BASE16_ENCODING = "HEX";
-   public static final String RFC2617_ENCODING = "RFC2617";
-   /**
-    The ASCII printable characters the MD5 digest maps to for RFC2617
-    */
-   private static char[] MD5_HEX = "0123456789abcdef".toCharArray();
-
-   private static SecureRandom psuedoRng;
-   private static MessageDigest sha1Digest;
-   private static boolean initialized;
-
-   public static void init() throws NoSuchAlgorithmException
-   {
-      if( initialized )
-         return;
-      init(null);
-   }
-   public static void init(byte[] prngSeed) throws NoSuchAlgorithmException
-   {
-      // Get an instance of the SHA-1 digest
-      sha1Digest = MessageDigest.getInstance("SHA");
-      // Get a cryptographically strong pseudo-random generator
-      psuedoRng = SecureRandom.getInstance("SHA1PRNG");
-      if( prngSeed != null )
-         psuedoRng.setSeed(prngSeed);
-      // Install the JBossSX security provider
-      Provider provider = new JBossSXProvider();
-      Security.addProvider(provider);
-      initialized = true;
-   }
-
-   public static MessageDigest newDigest()
-   {
-      MessageDigest md = null;
-      try
-      {
-         md = (MessageDigest) sha1Digest.clone();
-      }
-      catch(CloneNotSupportedException e)
-      {
-      }
-      return md;
-   }
-   public static MessageDigest copy(MessageDigest md)
-   {
-      MessageDigest copy = null;
-      try
-      {
-         copy = (MessageDigest) md.clone();
-      }
-      catch(CloneNotSupportedException e)
-      {
-      }
-      return copy;
-   }
-
-   public static Random getPRNG()
-   {
-      return psuedoRng;
-   }
-   /** Returns the next pseudorandom, uniformly distributed double value
-    between 0.0 and 1.0 from this random number generator's sequence.
-    */
-   public static double nextDouble()
-   {
-      return psuedoRng.nextDouble();
-   }
-   /** Returns the next pseudorandom, uniformly distributed long value from
-    this random number generator's sequence. The general contract of
-    nextLong is that one long value is pseudorandomly generated and
-    returned. All 264 possible long values are produced with
-    (approximately) equal probability.
-    */
-   public static long nextLong()
-   {
-      return psuedoRng.nextLong();
-   }
-   /** Generates random bytes and places them into a user-supplied byte
-    array. The number of random bytes produced is equal to the length
-    of the byte array.
-    */
-   public static void nextBytes(byte[] bytes)
-   {
-      psuedoRng.nextBytes(bytes);
-   }
-   /** Returns the given number of seed bytes, computed using the seed
-    generation algorithm that this class uses to seed itself. This call
-    may be used to seed other random number generators.
-    */
-   public static byte[] generateSeed(int numBytes)
-   {
-      return psuedoRng.generateSeed(numBytes);
-   }
-
-   /** Cacluate the SRP RFC2945 password hash = H(salt | H(username | ':' | password))
-    where H = SHA secure hash. The username is converted to a byte[] using the
-    UTF-8 encoding.
-    */
-   public static byte[] calculatePasswordHash(String username, char[] password,
-      byte[] salt)
-   {
-      // Calculate x = H(s | H(U | ':' | password))
-      MessageDigest xd = newDigest();
-      // Try to convert the username to a byte[] using UTF-8
-      byte[] user = null;
-      byte[] colon = {};
-      try
-      {
-         user = username.getBytes("UTF-8");
-         colon = ":".getBytes("UTF-8");
-      }
-      catch(UnsupportedEncodingException e)
-      {
-         log.error("Failed to convert username to byte[] using UTF-8", e);
-         // Use the default platform encoding
-         user = username.getBytes();
-         colon = ":".getBytes();
-      }
-      byte[] passBytes = new byte[2*password.length];
-      int passBytesLength = 0;
-      for(int p = 0; p < password.length; p ++)
-      {
-         int c = (password[p] & 0x00FFFF);
-         // The low byte of the char
-         byte b0 = (byte) (c & 0x0000FF);
-         // The high byte of the char
-         byte b1 = (byte) ((c & 0x00FF00) >> 8);
-         passBytes[passBytesLength ++] = b0;
-         // Only encode the high byte if c is a multi-byte char
-         if( c > 255 )
-            passBytes[passBytesLength ++] = b1;
-      }
-
-      // Build the hash
-      xd.update(user);
-      xd.update(colon);
-      xd.update(passBytes, 0, passBytesLength);
-      byte[] h = xd.digest();
-      xd.reset();
-      xd.update(salt);
-      xd.update(h);
-      byte[] xb = xd.digest();
-      return xb;
-   }
-
-   /** Calculate x = H(s | H(U | ':' | password)) verifier
-    v = g^x % N
-    described in RFC2945.
-    */
-   public static byte[] calculateVerifier(String username, char[] password,
-      byte[] salt, byte[] Nb, byte[] gb)
-   {
-      BigInteger g = new BigInteger(1, gb);
-      BigInteger N = new BigInteger(1, Nb);
-      return calculateVerifier(username, password, salt, N, g);
-   }
-   /** Calculate x = H(s | H(U | ':' | password)) verifier
-    v = g^x % N
-    described in RFC2945.
-    */
-   public static byte[] calculateVerifier(String username, char[] password,
-      byte[] salt, BigInteger N, BigInteger g)
-   {
-      byte[] xb = calculatePasswordHash(username, password, salt);
-      BigInteger x = new BigInteger(1, xb);
-      BigInteger v = g.modPow(x, N);
-      return v.toByteArray();
-   }
-
-   /** Perform an interleaved even-odd hash on the byte string
-    */
-   public static byte[] sessionKeyHash(byte[] number)
-   {
-      int i, offset;
-
-      for(offset = 0; offset < number.length && number[offset] == 0; ++offset)
-         ;
-
-      byte[] key = new byte[2 * HASH_LEN];
-      byte[] hout;
-
-      int klen = (number.length - offset) / 2;
-      byte[] hbuf = new byte[klen];
-
-      for(i = 0; i < klen; ++i)
-      {
-         hbuf[i] = number[number.length - 2 * i - 1];
-      }
-      hout = newDigest().digest(hbuf);
-      for(i = 0; i < HASH_LEN; ++i)
-         key[2 * i] = hout[i];
-
-      for(i = 0; i < klen; ++i)
-      {
-         hbuf[i] = number[number.length - 2 * i - 2];
-      }
-      hout = newDigest().digest(hbuf);
-      for(i = 0; i < HASH_LEN; ++i)
-         key[2 * i + 1] = hout[i];
-
-      return key;
-   }
-
-   /** Treat the input as the MSB representation of a number,
-    and lop off leading zero elements.  For efficiency, the
-    input is simply returned if no leading zeroes are found.
-    */
-   public static byte[] trim(byte[] in)
-   {
-      if(in.length == 0 || in[0] != 0)
-         return in;
-
-      int len = in.length;
-      int i = 1;
-      while(in[i] == 0 && i < len)
-         ++i;
-      byte[] ret = new byte[len - i];
-      System.arraycopy(in, i, ret, 0, len - i);
-      return ret;
-   }
-
-   public static byte[] xor(byte[] b1, byte[] b2, int length)
-   {
-      byte[] result = new byte[length];
-      for(int i = 0; i < length; ++i)
-         result[i] = (byte) (b1[i] ^ b2[i]);
-      return result;
-   }
-
-   /**
-    3.1.3 Representation of digest values
-
-    An optional header allows the server to specify the algorithm used to create
-    the checksum or digest. By default the MD5 algorithm is used and that is the
-    only algorithm described in this document.
-
-    For the purposes of this document, an MD5 digest of 128 bits is represented
-    as 32 ASCII printable characters. The bits in the 128 bit digest are
-    converted from most significant to least significant bit, four bits at a time
-    to their ASCII presentation as follows. Each four bits is represented by its
-    familiar hexadecimal notation from the characters 0123456789abcdef. That is,
-    binary 0000 getInfos represented by the character '0', 0001, by '1', and so
-    on up to the representation of 1111 as 'f'.
-    
-    @param data - the raw MD5 hash data
-    @return the encoded MD5 representation
-    */
-   public static String encodeRFC2617(byte[] data)
-   {
-      char[] hash = new char[32];
-      for (int i = 0; i < 16; i++)
-      {
-         int j = (data[i] >> 4) & 0xf;
-         hash[i * 2] = MD5_HEX[j];
-         j = data[i] & 0xf;
-         hash[i * 2 + 1] = MD5_HEX[j];
-      }
-      return new String(hash);
-   }
-
-   /**
-    * Hex encoding of hashes, as used by Catalina. Each byte is converted to
-    * the corresponding two hex characters.
-    */
-   public static String encodeBase16(byte[] bytes)
-   {
-      StringBuffer sb = new StringBuffer(bytes.length * 2);
-      for (int i = 0; i < bytes.length; i++)
-      {
-         byte b = bytes[i];
-         // top 4 bits
-         char c = (char)((b >> 4) & 0xf);
-         if(c > 9)
-            c = (char)((c - 10) + 'a');
-         else
-            c = (char)(c + '0');
-         sb.append(c);
-         // bottom 4 bits
-         c = (char)(b & 0xf);
-         if (c > 9)
-            c = (char)((c - 10) + 'a');
-         else
-            c = (char)(c + '0');
-         sb.append(c);
-      }
-      return sb.toString();
-   }
-
-   /**
-    * BASE64 encoder implementation.
-    * Provides encoding methods, using the BASE64 encoding rules, as defined
-    * in the MIME specification, <a href="http://ietf.org/rfc/rfc1521.txt">rfc1521</a>.
-    */
-   public static String encodeBase64(byte[] bytes)
-   {
-      String base64 = null;
-      try
-      {
-         base64 = Base64Encoder.encode(bytes);
-      }
-      catch(Exception e)
-      {
-      }
-      return base64;
-   }
-
-  /**
-   * Calculate a password hash using a MessageDigest.
-   *
-   * @param hashAlgorithm - the MessageDigest algorithm name
-   * @param hashEncoding - either base64 or hex to specify the type of
-      encoding the MessageDigest as a string.
-   * @param hashCharset - the charset used to create the byte[] passed to the
-   *  MessageDigestfrom the password String. If null the platform default is
-   *  used.
-   * @param username - ignored in default version
-   * @param password - the password string to be hashed
-   * @return the hashed string if successful, null if there is a digest exception
-   */
-   public static String createPasswordHash(String hashAlgorithm, String hashEncoding,
-      String hashCharset, String username, String password)
-  {
-     return createPasswordHash(hashAlgorithm, hashEncoding,
-      hashCharset, username, password, null);
-  }
-   /**
-    * Calculate a password hash using a MessageDigest.
-    *
-    * @param hashAlgorithm - the MessageDigest algorithm name
-    * @param hashEncoding - either base64 or hex to specify the type of
-       encoding the MessageDigest as a string.
-    * @param hashCharset - the charset used to create the byte[] passed to the
-    *  MessageDigestfrom the password String. If null the platform default is
-    *  used.
-    * @param username - ignored in default version
-    * @param password - the password string to be hashed
-    * @param callback - the callback used to allow customization of the hash
-    *    to occur. The preDigest method is called before the password is added
-    *    and the postDigest method is called after the password has been added.
-    * @return the hashed string if successful, null if there is a digest exception
-    */ 
-   public static String createPasswordHash(String hashAlgorithm, String hashEncoding,
-      String hashCharset, String username, String password, DigestCallback callback)
-   {
-      byte[] passBytes;
-      String passwordHash = null;
-
-      // convert password to byte data
-      try
-      {
-         if(hashCharset == null)
-            passBytes = password.getBytes();
-         else
-            passBytes = password.getBytes(hashCharset);
-      }
-      catch(UnsupportedEncodingException uee)
-      {
-         log.error("charset " + hashCharset + " not found. Using platform default.", uee);
-         passBytes = password.getBytes();
-      }
-
-      // calculate the hash and apply the encoding.
-      try
-      {
-         MessageDigest md = MessageDigest.getInstance(hashAlgorithm);
-         if( callback != null )
-            callback.preDigest(md);
-         md.update(passBytes);
-         if( callback != null )
-            callback.postDigest(md);
-         byte[] hash = md.digest();
-         if(hashEncoding.equalsIgnoreCase(BASE64_ENCODING))
-         {
-            passwordHash =  encodeBase64(hash);
-         }
-         else if(hashEncoding.equalsIgnoreCase(BASE16_ENCODING))
-         {
-            passwordHash =  encodeBase16(hash);
-         }
-         else if(hashEncoding.equalsIgnoreCase(RFC2617_ENCODING))
-         {
-            passwordHash =  encodeRFC2617(hash);
-         }
-         else
-         {
-            log.error("Unsupported hash encoding format " + hashEncoding);
-         }
-      }
-      catch(Exception e)
-      {
-         log.error("Password hash calculation failed ", e);
-      }
-      return passwordHash;
-   }
-
-   // These functions assume that the byte array has MSB at 0, LSB at end.
-   // Reverse the byte array (not the String) if this is not the case.
-   // All base64 strings are in natural order, least significant digit last.
-   public static String tob64(byte[] buffer)
-   {
-      return Base64Utils.tob64(buffer);
-   }
-
-   public static byte[] fromb64(String str) throws NumberFormatException
-   {
-      return Base64Utils.fromb64(str);
-   }
-
-   /** From Appendix E of the JCE ref guide, the xaximum key size
-    * allowed by the "Strong" jurisdiction policy files allows a maximum Blowfish
-    * cipher size of 128 bits.
-    * @return true if a Blowfish key can be initialized with 256 bit
-    * size, false otherwise.
-    */ 
-   public static boolean hasUnlimitedCrypto()
-   {
-      boolean hasUnlimitedCrypto = false;
-      try
-      {
-         ClassLoader loader = Thread.currentThread().getContextClassLoader();
-         Class keyGenClass = loader.loadClass("javax.crypto.KeyGenerator");
-         Class[] sig = {String.class};
-         Object[] args = {"Blowfish"};
-         Method kgenInstance = keyGenClass.getDeclaredMethod("getInstance", sig);
-         Object kgen = kgenInstance.invoke(null, args);
-
-         Class[] sig2 = {int.class};
-         Object[] args2 = {new Integer(256)};
-         Method init = keyGenClass.getDeclaredMethod("init", sig2);         
-         init.invoke(kgen, args2);
-         hasUnlimitedCrypto = true;
-      }
-      catch(Throwable e)
-      {
-         log.debug("hasUnlimitedCrypto error", e);
-      }
-      return hasUnlimitedCrypto;
-   }
-
-   /** Use reflection to create a javax.crypto.spec.SecretKeySpec to avoid
-    an explicit reference to SecretKeySpec so that the JCE is not needed
-    unless the SRP parameters indicate that encryption is needed.
-    @return a javax.cyrpto.SecretKey
-   */
-   public static Object createSecretKey(String cipherAlgorithm, Object key) throws KeyException
-   {
-      Class[] signature = {key.getClass(), String.class};
-      Object[] args = {key, cipherAlgorithm};
-      Object secretKey = null;
-      try
-      {
-          ClassLoader loader = Thread.currentThread().getContextClassLoader();
-          Class secretKeySpecClass = loader.loadClass("javax.crypto.spec.SecretKeySpec");
-          Constructor ctor = secretKeySpecClass.getDeclaredConstructor(signature);
-          secretKey = ctor.newInstance(args);
-      }
-      catch(Exception e)
-      {
-          throw new KeyException("Failed to create SecretKeySpec from session key, msg="+e.getMessage());
-      }
-      catch(Throwable e)
-      {
-         throw new KeyException("Unexpected exception during SecretKeySpec creation, msg="+e.getMessage());
-      }
-      return secretKey;
-   }
-
-   /**
-    * @param cipherAlgorithm
-    * @return A javax.crypto.Cipher
-    * @throws GeneralSecurityException
-    */ 
-   public static Object createCipher(String cipherAlgorithm)
-      throws GeneralSecurityException
-   {
-      javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(cipherAlgorithm);
-      return cipher;
-   }
-   public static Object createSealedObject(String cipherAlgorithm, Object key, byte[] cipherIV,
-      Serializable data)
-      throws GeneralSecurityException
-   {
-      Object sealedObject = null;
-      try
-      {
-          javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(cipherAlgorithm);
-         javax.crypto.SecretKey skey = (javax.crypto.SecretKey) key;
-         if( cipherIV != null )
-         {
-            javax.crypto.spec.IvParameterSpec iv = new javax.crypto.spec.IvParameterSpec(cipherIV);
-            cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, skey, iv);
-         }
-         else
-         {
-            cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, skey);
-         }
-         sealedObject = new javax.crypto.SealedObject(data, cipher);
-      }
-      catch(GeneralSecurityException e)
-      {
-          throw e;
-      }
-      catch(Throwable e)
-      {
-         throw new GeneralSecurityException("Failed to create SealedObject, msg="+e.getMessage());
-      }
-      return sealedObject;
-   }
-
-   public static Object accessSealedObject(String cipherAlgorithm, Object key, byte[] cipherIV,
-      Object obj)
-      throws GeneralSecurityException
-   {
-      Object data = null;
-      try
-      {
-          javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(cipherAlgorithm);
-         javax.crypto.SecretKey skey = (javax.crypto.SecretKey) key;
-         if( cipherIV != null )
-         {
-            javax.crypto.spec.IvParameterSpec iv = new javax.crypto.spec.IvParameterSpec(cipherIV);
-            cipher.init(javax.crypto.Cipher.DECRYPT_MODE, skey, iv);
-         }
-         else
-         {
-            cipher.init(javax.crypto.Cipher.DECRYPT_MODE, skey);
-         }
-         javax.crypto.SealedObject sealedObj = (javax.crypto.SealedObject) obj;
-         data = sealedObj.getObject(cipher);
-      }
-      catch(GeneralSecurityException e)
-      {
-          throw e;
-      }
-      catch(Throwable e)
-      {
-         throw new GeneralSecurityException("Failed to access SealedObject, msg="+e.getMessage());
-      }
-      return data;
-   }
-   
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/CryptoUtil.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/crypto/CryptoUtil.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/CryptoUtil.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/CryptoUtil.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,598 @@
+/*
+* 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.crypto;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.math.BigInteger;
+import java.security.GeneralSecurityException;
+import java.security.KeyException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.util.Random;
+
+import org.jboss.crypto.digest.DigestCallback;
+import org.jboss.logging.Logger;
+import org.jboss.security.Base64Encoder;
+import org.jboss.security.Base64Utils;
+
+/** Various security related utilities like MessageDigest
+ factories, SecureRandom access, password hashing.
+
+ This product includes software developed by Tom Wu and Eugene
+ Jhong for the SRP Distribution (http://srp.stanford.edu/srp/).
+
+ @author Scott.Stark at jboss.org
+ @version $Revision: 62650 $
+ */
+public class CryptoUtil
+{
+   private static Logger log = Logger.getLogger(CryptoUtil.class);
+   private static final int HASH_LEN = 20;
+   public static final String BASE64_ENCODING = "BASE64";
+   public static final String BASE16_ENCODING = "HEX";
+   public static final String RFC2617_ENCODING = "RFC2617";
+   /**
+    The ASCII printable characters the MD5 digest maps to for RFC2617
+    */
+   private static char[] MD5_HEX = "0123456789abcdef".toCharArray();
+
+   private static SecureRandom psuedoRng;
+   private static MessageDigest sha1Digest;
+   private static boolean initialized;
+
+   public static void init() throws NoSuchAlgorithmException
+   {
+      if( initialized )
+         return;
+      init(null);
+   }
+   public static void init(byte[] prngSeed) throws NoSuchAlgorithmException
+   {
+      // Get an instance of the SHA-1 digest
+      sha1Digest = MessageDigest.getInstance("SHA");
+      // Get a cryptographically strong pseudo-random generator
+      psuedoRng = SecureRandom.getInstance("SHA1PRNG");
+      if( prngSeed != null )
+         psuedoRng.setSeed(prngSeed);
+      // Install the JBossSX security provider
+      Provider provider = new JBossSXProvider();
+      Security.addProvider(provider);
+      initialized = true;
+   }
+
+   public static MessageDigest newDigest()
+   {
+      MessageDigest md = null;
+      try
+      {
+         md = (MessageDigest) sha1Digest.clone();
+      }
+      catch(CloneNotSupportedException e)
+      {
+      }
+      return md;
+   }
+   public static MessageDigest copy(MessageDigest md)
+   {
+      MessageDigest copy = null;
+      try
+      {
+         copy = (MessageDigest) md.clone();
+      }
+      catch(CloneNotSupportedException e)
+      {
+      }
+      return copy;
+   }
+
+   public static Random getPRNG()
+   {
+      return psuedoRng;
+   }
+   /** Returns the next pseudorandom, uniformly distributed double value
+    between 0.0 and 1.0 from this random number generator's sequence.
+    */
+   public static double nextDouble()
+   {
+      return psuedoRng.nextDouble();
+   }
+   /** Returns the next pseudorandom, uniformly distributed long value from
+    this random number generator's sequence. The general contract of
+    nextLong is that one long value is pseudorandomly generated and
+    returned. All 264 possible long values are produced with
+    (approximately) equal probability.
+    */
+   public static long nextLong()
+   {
+      return psuedoRng.nextLong();
+   }
+   /** Generates random bytes and places them into a user-supplied byte
+    array. The number of random bytes produced is equal to the length
+    of the byte array.
+    */
+   public static void nextBytes(byte[] bytes)
+   {
+      psuedoRng.nextBytes(bytes);
+   }
+   /** Returns the given number of seed bytes, computed using the seed
+    generation algorithm that this class uses to seed itself. This call
+    may be used to seed other random number generators.
+    */
+   public static byte[] generateSeed(int numBytes)
+   {
+      return psuedoRng.generateSeed(numBytes);
+   }
+
+   /** Cacluate the SRP RFC2945 password hash = H(salt | H(username | ':' | password))
+    where H = SHA secure hash. The username is converted to a byte[] using the
+    UTF-8 encoding.
+    */
+   public static byte[] calculatePasswordHash(String username, char[] password,
+      byte[] salt)
+   {
+      // Calculate x = H(s | H(U | ':' | password))
+      MessageDigest xd = newDigest();
+      // Try to convert the username to a byte[] using UTF-8
+      byte[] user = null;
+      byte[] colon = {};
+      try
+      {
+         user = username.getBytes("UTF-8");
+         colon = ":".getBytes("UTF-8");
+      }
+      catch(UnsupportedEncodingException e)
+      {
+         log.error("Failed to convert username to byte[] using UTF-8", e);
+         // Use the default platform encoding
+         user = username.getBytes();
+         colon = ":".getBytes();
+      }
+      byte[] passBytes = new byte[2*password.length];
+      int passBytesLength = 0;
+      for(int p = 0; p < password.length; p ++)
+      {
+         int c = (password[p] & 0x00FFFF);
+         // The low byte of the char
+         byte b0 = (byte) (c & 0x0000FF);
+         // The high byte of the char
+         byte b1 = (byte) ((c & 0x00FF00) >> 8);
+         passBytes[passBytesLength ++] = b0;
+         // Only encode the high byte if c is a multi-byte char
+         if( c > 255 )
+            passBytes[passBytesLength ++] = b1;
+      }
+
+      // Build the hash
+      xd.update(user);
+      xd.update(colon);
+      xd.update(passBytes, 0, passBytesLength);
+      byte[] h = xd.digest();
+      xd.reset();
+      xd.update(salt);
+      xd.update(h);
+      byte[] xb = xd.digest();
+      return xb;
+   }
+
+   /** Calculate x = H(s | H(U | ':' | password)) verifier
+    v = g^x % N
+    described in RFC2945.
+    */
+   public static byte[] calculateVerifier(String username, char[] password,
+      byte[] salt, byte[] Nb, byte[] gb)
+   {
+      BigInteger g = new BigInteger(1, gb);
+      BigInteger N = new BigInteger(1, Nb);
+      return calculateVerifier(username, password, salt, N, g);
+   }
+   /** Calculate x = H(s | H(U | ':' | password)) verifier
+    v = g^x % N
+    described in RFC2945.
+    */
+   public static byte[] calculateVerifier(String username, char[] password,
+      byte[] salt, BigInteger N, BigInteger g)
+   {
+      byte[] xb = calculatePasswordHash(username, password, salt);
+      BigInteger x = new BigInteger(1, xb);
+      BigInteger v = g.modPow(x, N);
+      return v.toByteArray();
+   }
+
+   /** Perform an interleaved even-odd hash on the byte string
+    */
+   public static byte[] sessionKeyHash(byte[] number)
+   {
+      int i, offset;
+
+      for(offset = 0; offset < number.length && number[offset] == 0; ++offset)
+         ;
+
+      byte[] key = new byte[2 * HASH_LEN];
+      byte[] hout;
+
+      int klen = (number.length - offset) / 2;
+      byte[] hbuf = new byte[klen];
+
+      for(i = 0; i < klen; ++i)
+      {
+         hbuf[i] = number[number.length - 2 * i - 1];
+      }
+      hout = newDigest().digest(hbuf);
+      for(i = 0; i < HASH_LEN; ++i)
+         key[2 * i] = hout[i];
+
+      for(i = 0; i < klen; ++i)
+      {
+         hbuf[i] = number[number.length - 2 * i - 2];
+      }
+      hout = newDigest().digest(hbuf);
+      for(i = 0; i < HASH_LEN; ++i)
+         key[2 * i + 1] = hout[i];
+
+      return key;
+   }
+
+   /** Treat the input as the MSB representation of a number,
+    and lop off leading zero elements.  For efficiency, the
+    input is simply returned if no leading zeroes are found.
+    */
+   public static byte[] trim(byte[] in)
+   {
+      if(in.length == 0 || in[0] != 0)
+         return in;
+
+      int len = in.length;
+      int i = 1;
+      while(in[i] == 0 && i < len)
+         ++i;
+      byte[] ret = new byte[len - i];
+      System.arraycopy(in, i, ret, 0, len - i);
+      return ret;
+   }
+
+   public static byte[] xor(byte[] b1, byte[] b2, int length)
+   {
+      byte[] result = new byte[length];
+      for(int i = 0; i < length; ++i)
+         result[i] = (byte) (b1[i] ^ b2[i]);
+      return result;
+   }
+
+   /**
+    3.1.3 Representation of digest values
+
+    An optional header allows the server to specify the algorithm used to create
+    the checksum or digest. By default the MD5 algorithm is used and that is the
+    only algorithm described in this document.
+
+    For the purposes of this document, an MD5 digest of 128 bits is represented
+    as 32 ASCII printable characters. The bits in the 128 bit digest are
+    converted from most significant to least significant bit, four bits at a time
+    to their ASCII presentation as follows. Each four bits is represented by its
+    familiar hexadecimal notation from the characters 0123456789abcdef. That is,
+    binary 0000 getInfos represented by the character '0', 0001, by '1', and so
+    on up to the representation of 1111 as 'f'.
+    
+    @param data - the raw MD5 hash data
+    @return the encoded MD5 representation
+    */
+   public static String encodeRFC2617(byte[] data)
+   {
+      char[] hash = new char[32];
+      for (int i = 0; i < 16; i++)
+      {
+         int j = (data[i] >> 4) & 0xf;
+         hash[i * 2] = MD5_HEX[j];
+         j = data[i] & 0xf;
+         hash[i * 2 + 1] = MD5_HEX[j];
+      }
+      return new String(hash);
+   }
+
+   /**
+    * Hex encoding of hashes, as used by Catalina. Each byte is converted to
+    * the corresponding two hex characters.
+    */
+   public static String encodeBase16(byte[] bytes)
+   {
+      StringBuffer sb = new StringBuffer(bytes.length * 2);
+      for (int i = 0; i < bytes.length; i++)
+      {
+         byte b = bytes[i];
+         // top 4 bits
+         char c = (char)((b >> 4) & 0xf);
+         if(c > 9)
+            c = (char)((c - 10) + 'a');
+         else
+            c = (char)(c + '0');
+         sb.append(c);
+         // bottom 4 bits
+         c = (char)(b & 0xf);
+         if (c > 9)
+            c = (char)((c - 10) + 'a');
+         else
+            c = (char)(c + '0');
+         sb.append(c);
+      }
+      return sb.toString();
+   }
+
+   /**
+    * BASE64 encoder implementation.
+    * Provides encoding methods, using the BASE64 encoding rules, as defined
+    * in the MIME specification, <a href="http://ietf.org/rfc/rfc1521.txt">rfc1521</a>.
+    */
+   public static String encodeBase64(byte[] bytes)
+   {
+      String base64 = null;
+      try
+      {
+         base64 = Base64Encoder.encode(bytes);
+      }
+      catch(Exception e)
+      {
+      }
+      return base64;
+   }
+
+  /**
+   * Calculate a password hash using a MessageDigest.
+   *
+   * @param hashAlgorithm - the MessageDigest algorithm name
+   * @param hashEncoding - either base64 or hex to specify the type of
+      encoding the MessageDigest as a string.
+   * @param hashCharset - the charset used to create the byte[] passed to the
+   *  MessageDigestfrom the password String. If null the platform default is
+   *  used.
+   * @param username - ignored in default version
+   * @param password - the password string to be hashed
+   * @return the hashed string if successful, null if there is a digest exception
+   */
+   public static String createPasswordHash(String hashAlgorithm, String hashEncoding,
+      String hashCharset, String username, String password)
+  {
+     return createPasswordHash(hashAlgorithm, hashEncoding,
+      hashCharset, username, password, null);
+  }
+   /**
+    * Calculate a password hash using a MessageDigest.
+    *
+    * @param hashAlgorithm - the MessageDigest algorithm name
+    * @param hashEncoding - either base64 or hex to specify the type of
+       encoding the MessageDigest as a string.
+    * @param hashCharset - the charset used to create the byte[] passed to the
+    *  MessageDigestfrom the password String. If null the platform default is
+    *  used.
+    * @param username - ignored in default version
+    * @param password - the password string to be hashed
+    * @param callback - the callback used to allow customization of the hash
+    *    to occur. The preDigest method is called before the password is added
+    *    and the postDigest method is called after the password has been added.
+    * @return the hashed string if successful, null if there is a digest exception
+    */ 
+   public static String createPasswordHash(String hashAlgorithm, String hashEncoding,
+      String hashCharset, String username, String password, DigestCallback callback)
+   {
+      byte[] passBytes;
+      String passwordHash = null;
+
+      // convert password to byte data
+      try
+      {
+         if(hashCharset == null)
+            passBytes = password.getBytes();
+         else
+            passBytes = password.getBytes(hashCharset);
+      }
+      catch(UnsupportedEncodingException uee)
+      {
+         log.error("charset " + hashCharset + " not found. Using platform default.", uee);
+         passBytes = password.getBytes();
+      }
+
+      // calculate the hash and apply the encoding.
+      try
+      {
+         MessageDigest md = MessageDigest.getInstance(hashAlgorithm);
+         if( callback != null )
+            callback.preDigest(md);
+         md.update(passBytes);
+         if( callback != null )
+            callback.postDigest(md);
+         byte[] hash = md.digest();
+         if(hashEncoding.equalsIgnoreCase(BASE64_ENCODING))
+         {
+            passwordHash =  encodeBase64(hash);
+         }
+         else if(hashEncoding.equalsIgnoreCase(BASE16_ENCODING))
+         {
+            passwordHash =  encodeBase16(hash);
+         }
+         else if(hashEncoding.equalsIgnoreCase(RFC2617_ENCODING))
+         {
+            passwordHash =  encodeRFC2617(hash);
+         }
+         else
+         {
+            log.error("Unsupported hash encoding format " + hashEncoding);
+         }
+      }
+      catch(Exception e)
+      {
+         log.error("Password hash calculation failed ", e);
+      }
+      return passwordHash;
+   }
+
+   // These functions assume that the byte array has MSB at 0, LSB at end.
+   // Reverse the byte array (not the String) if this is not the case.
+   // All base64 strings are in natural order, least significant digit last.
+   public static String tob64(byte[] buffer)
+   {
+      return Base64Utils.tob64(buffer);
+   }
+
+   public static byte[] fromb64(String str) throws NumberFormatException
+   {
+      return Base64Utils.fromb64(str);
+   }
+
+   /** From Appendix E of the JCE ref guide, the xaximum key size
+    * allowed by the "Strong" jurisdiction policy files allows a maximum Blowfish
+    * cipher size of 128 bits.
+    * @return true if a Blowfish key can be initialized with 256 bit
+    * size, false otherwise.
+    */ 
+   public static boolean hasUnlimitedCrypto()
+   {
+      boolean hasUnlimitedCrypto = false;
+      try
+      {
+         ClassLoader loader = Thread.currentThread().getContextClassLoader();
+         Class<?> keyGenClass = loader.loadClass("javax.crypto.KeyGenerator");
+         Class<?>[] sig = {String.class};
+         Object[] args = {"Blowfish"};
+         Method kgenInstance = keyGenClass.getDeclaredMethod("getInstance", sig);
+         Object kgen = kgenInstance.invoke(null, args);
+
+         Class<?>[] sig2 = {int.class};
+         Object[] args2 = {new Integer(256)};
+         Method init = keyGenClass.getDeclaredMethod("init", sig2);         
+         init.invoke(kgen, args2);
+         hasUnlimitedCrypto = true;
+      }
+      catch(Throwable e)
+      {
+         log.debug("hasUnlimitedCrypto error", e);
+      }
+      return hasUnlimitedCrypto;
+   }
+
+   /** Use reflection to create a javax.crypto.spec.SecretKeySpec to avoid
+    an explicit reference to SecretKeySpec so that the JCE is not needed
+    unless the SRP parameters indicate that encryption is needed.
+    @return a javax.cyrpto.SecretKey
+   */
+   public static Object createSecretKey(String cipherAlgorithm, Object key) throws KeyException
+   {
+      Class<?>[] signature = {key.getClass(), String.class};
+      Object[] args = {key, cipherAlgorithm};
+      Object secretKey = null;
+      try
+      {
+          ClassLoader loader = Thread.currentThread().getContextClassLoader();
+          Class<?> secretKeySpecClass = loader.loadClass("javax.crypto.spec.SecretKeySpec");
+          Constructor<?> ctor = secretKeySpecClass.getDeclaredConstructor(signature);
+          secretKey = ctor.newInstance(args);
+      }
+      catch(Exception e)
+      {
+          throw new KeyException("Failed to create SecretKeySpec from session key, msg="+e.getMessage());
+      }
+      catch(Throwable e)
+      {
+         throw new KeyException("Unexpected exception during SecretKeySpec creation, msg="+e.getMessage());
+      }
+      return secretKey;
+   }
+
+   /**
+    * @param cipherAlgorithm
+    * @return A javax.crypto.Cipher
+    * @throws GeneralSecurityException
+    */ 
+   public static Object createCipher(String cipherAlgorithm)
+      throws GeneralSecurityException
+   {
+      javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(cipherAlgorithm);
+      return cipher;
+   }
+   public static Object createSealedObject(String cipherAlgorithm, Object key, byte[] cipherIV,
+      Serializable data)
+      throws GeneralSecurityException
+   {
+      Object sealedObject = null;
+      try
+      {
+          javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(cipherAlgorithm);
+         javax.crypto.SecretKey skey = (javax.crypto.SecretKey) key;
+         if( cipherIV != null )
+         {
+            javax.crypto.spec.IvParameterSpec iv = new javax.crypto.spec.IvParameterSpec(cipherIV);
+            cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, skey, iv);
+         }
+         else
+         {
+            cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, skey);
+         }
+         sealedObject = new javax.crypto.SealedObject(data, cipher);
+      }
+      catch(GeneralSecurityException e)
+      {
+          throw e;
+      }
+      catch(Throwable e)
+      {
+         throw new GeneralSecurityException("Failed to create SealedObject, msg="+e.getMessage());
+      }
+      return sealedObject;
+   }
+
+   public static Object accessSealedObject(String cipherAlgorithm, Object key, byte[] cipherIV,
+      Object obj)
+      throws GeneralSecurityException
+   {
+      Object data = null;
+      try
+      {
+          javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance(cipherAlgorithm);
+         javax.crypto.SecretKey skey = (javax.crypto.SecretKey) key;
+         if( cipherIV != null )
+         {
+            javax.crypto.spec.IvParameterSpec iv = new javax.crypto.spec.IvParameterSpec(cipherIV);
+            cipher.init(javax.crypto.Cipher.DECRYPT_MODE, skey, iv);
+         }
+         else
+         {
+            cipher.init(javax.crypto.Cipher.DECRYPT_MODE, skey);
+         }
+         javax.crypto.SealedObject sealedObj = (javax.crypto.SealedObject) obj;
+         data = sealedObj.getObject(cipher);
+      }
+      catch(GeneralSecurityException e)
+      {
+          throw e;
+      }
+      catch(Throwable e)
+      {
+         throw new GeneralSecurityException("Failed to access SealedObject, msg="+e.getMessage());
+      }
+      return data;
+   }
+   
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/digest/DigestCallback.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/crypto/digest/DigestCallback.java	2008-01-10 05:29:26 UTC (rev 68788)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/digest/DigestCallback.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,55 +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.crypto.digest;
-
-import java.security.MessageDigest;
-import java.util.Map;
-
-/**
- * An interface that can be used to augment the behavior of a digest hash.
- * One example usecase is with the password based login modules to
- * modify the behavior of the hashing to introduce prefix/suffix salts.
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public interface DigestCallback
-{
-   /** Pass through access to the login module options. When coming from a
-    * login module this includes the following keys:
-    * javax.security.auth.login.name - for the username
-    * javax.security.auth.login.password - for the String password
-    */
-   public void init(Map options);
-   /**
-    * Pre-hash callout to allow for content before the password. Any content
-    * should be added using the MessageDigest update methods.
-    * @param digest - the security digest being used for the one-way hash
-    */ 
-   public void preDigest(MessageDigest digest);
-   /** Post-hash callout afer the password has been added to allow for content
-    * after the password has been added. Any content should be added using the
-    * MessageDigest update methods.
-    * @param digest - the security digest being used for the one-way hash
-    */
-   public void postDigest(MessageDigest digest);
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/digest/DigestCallback.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/crypto/digest/DigestCallback.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/digest/DigestCallback.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/crypto/digest/DigestCallback.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,55 @@
+/*
+* 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.crypto.digest;
+
+import java.security.MessageDigest;
+import java.util.Map;
+
+/**
+ * An interface that can be used to augment the behavior of a digest hash.
+ * One example usecase is with the password based login modules to
+ * modify the behavior of the hashing to introduce prefix/suffix salts.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DigestCallback
+{
+   /** Pass through access to the login module options. When coming from a
+    * login module this includes the following keys:
+    * javax.security.auth.login.name - for the username
+    * javax.security.auth.login.password - for the String password
+    */
+   public void init(Map<String,Object> options);
+   /**
+    * Pre-hash callout to allow for content before the password. Any content
+    * should be added using the MessageDigest update methods.
+    * @param digest - the security digest being used for the one-way hash
+    */ 
+   public void preDigest(MessageDigest digest);
+   /** Post-hash callout afer the password has been added to allow for content
+    * after the password has been added. Any content should be added using the
+    * MessageDigest update methods.
+    * @param digest - the security digest being used for the one-way hash
+    */
+   public void postDigest(MessageDigest digest);
+}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security (from rev 68959, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security)

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,221 +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.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.
- This is a variation of the original ClientLoginModule that does not set the
- SecurityAssociation information until commit and that uses the Subject
- principal over a SimplePrincipal if available.
-
- 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>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 Scott.Stark at jboss.org
- @version $Revision$
- */
-public class AltClientLoginModule implements LoginModule
-{
-   private static Logger log = Logger.getLogger(AltClientLoginModule.class);
-   private Subject subject;
-   private CallbackHandler callbackHandler;
-   /** Shared state between login modules */
-   private Map sharedState;
-   /** Flag indicating if the shared password should be used */
-   private boolean useFirstPass;
-   private String username;
-   private char[] password = null;
-   private boolean trace;
-
-   /**
-    * Initialize this LoginModule.
-    */
-   public void initialize(Subject subject, CallbackHandler callbackHandler,
-      Map sharedState, Map 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 mt = (String) options.get("multi-threaded");
-      if( Boolean.valueOf(mt).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();
-      }
-      
-        /* 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 useFirstPass is true, look for the shared password
-      if( useFirstPass == true )
-      {
-            return true;
-      }
-
-     /* 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
-      {
-         char[] tmpPassword;
-         
-         callbackHandler.handle(callbacks);
-         username = nc.getName();
-         tmpPassword = pc.getPassword();
-         if (tmpPassword != null)
-         {
-            password = new char[tmpPassword.length];
-            System.arraycopy(tmpPassword, 0, password, 0, tmpPassword.length);
-            pc.clearPassword();
-         }
-      }
-      catch (java.io.IOException ioe)
-      {
-         throw new LoginException(ioe.toString());
-      }
-      catch (UnsupportedCallbackException uce)
-      {
-         throw new LoginException("Error: " + uce.getCallback().toString() +
-         " not available to garner authentication information " +
-         "from the user");
-      }
-      return true;
-   }
-
-   /** Method to commit the authentication process (phase 2). This is where the
-    * SecurityAssociation information is set. The principal is obtained from:
-    * The shared state javax.security.auth.login.name property when useFirstPass
-    * is true. If the value is a Principal it is used as is, else a SimplePrincipal
-    * using the value.toString() as its name is used. If useFirstPass the
-    * username obtained from the callback handler is used to build the
-    * SimplePrincipal. Both may be overriden if the resulting authenticated
-    * Subject principals set it not empty.
-    * 
-    */
-   public boolean commit() throws LoginException
-   {
-      Set principals = subject.getPrincipals();
-      Principal p = null;
-      Object credential = password;
-      if( useFirstPass == true )
-      {
-         Object user = sharedState.get("javax.security.auth.login.name");
-         if( (user instanceof Principal) == false )
-         {
-            username = user != null ? user.toString() : "";
-            p = new SimplePrincipal(username);
-         }
-         else
-         {
-            p = (Principal) user;
-         }
-         credential = sharedState.get("javax.security.auth.login.password");
-      }
-      else
-      {
-         p = new SimplePrincipal(username);
-      }
-
-      if( principals.isEmpty() == false )
-         p = (Principal) principals.iterator().next();
-      SecurityAssociationActions.setPrincipalInfo(p, credential, subject);
-      return true;
-   }
-
-   /**
-    * Method to abort the authentication process (phase 2).
-    */
-   public boolean abort() throws LoginException
-   {
-      int length = password != null ? password.length : 0;
-      for(int n = 0; n < length; n ++)
-         password[n] = 0;
-      SecurityAssociationActions.clear();
-      return true;
-   }
-
-   public boolean logout() throws LoginException
-   {
-      SecurityAssociationActions.clear();
-      return true;
-   }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,221 @@
+/*
+* 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.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.
+ This is a variation of the original ClientLoginModule that does not set the
+ SecurityAssociation information until commit and that uses the Subject
+ principal over a SimplePrincipal if available.
+
+ 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>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 Scott.Stark at jboss.org
+ @version $Revision$
+ */
+public class AltClientLoginModule implements LoginModule
+{
+   private static Logger log = Logger.getLogger(AltClientLoginModule.class);
+   private Subject subject;
+   private CallbackHandler callbackHandler;
+   /** Shared state between login modules */
+   private Map<String,?> sharedState;
+   /** Flag indicating if the shared password should be used */
+   private boolean useFirstPass;
+   private String username;
+   private char[] password = null;
+   private boolean trace;
+
+   /**
+    * Initialize this LoginModule.
+    */
+   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 mt = (String) options.get("multi-threaded");
+      if( Boolean.valueOf(mt).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();
+      }
+      
+        /* 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 useFirstPass is true, look for the shared password
+      if( useFirstPass == true )
+      {
+            return true;
+      }
+
+     /* 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
+      {
+         char[] tmpPassword;
+         
+         callbackHandler.handle(callbacks);
+         username = nc.getName();
+         tmpPassword = pc.getPassword();
+         if (tmpPassword != null)
+         {
+            password = new char[tmpPassword.length];
+            System.arraycopy(tmpPassword, 0, password, 0, tmpPassword.length);
+            pc.clearPassword();
+         }
+      }
+      catch (java.io.IOException ioe)
+      {
+         throw new LoginException(ioe.toString());
+      }
+      catch (UnsupportedCallbackException uce)
+      {
+         throw new LoginException("Error: " + uce.getCallback().toString() +
+         " not available to garner authentication information " +
+         "from the user");
+      }
+      return true;
+   }
+
+   /** Method to commit the authentication process (phase 2). This is where the
+    * SecurityAssociation information is set. The principal is obtained from:
+    * The shared state javax.security.auth.login.name property when useFirstPass
+    * is true. If the value is a Principal it is used as is, else a SimplePrincipal
+    * using the value.toString() as its name is used. If useFirstPass the
+    * username obtained from the callback handler is used to build the
+    * SimplePrincipal. Both may be overriden if the resulting authenticated
+    * Subject principals set it not empty.
+    * 
+    */
+   public boolean commit() throws LoginException
+   {
+      Set<Principal> principals = subject.getPrincipals();
+      Principal p = null;
+      Object credential = password;
+      if( useFirstPass == true )
+      {
+         Object user = sharedState.get("javax.security.auth.login.name");
+         if( (user instanceof Principal) == false )
+         {
+            username = user != null ? user.toString() : "";
+            p = new SimplePrincipal(username);
+         }
+         else
+         {
+            p = (Principal) user;
+         }
+         credential = sharedState.get("javax.security.auth.login.password");
+      }
+      else
+      {
+         p = new SimplePrincipal(username);
+      }
+
+      if( principals.isEmpty() == false )
+         p = (Principal) principals.iterator().next();
+      SecurityAssociationActions.setPrincipalInfo(p, credential, subject);
+      return true;
+   }
+
+   /**
+    * Method to abort the authentication process (phase 2).
+    */
+   public boolean abort() throws LoginException
+   {
+      int length = password != null ? password.length : 0;
+      for(int n = 0; n < length; n ++)
+         password[n] = 0;
+      SecurityAssociationActions.clear();
+      return true;
+   }
+
+   public boolean logout() throws LoginException
+   {
+      SecurityAssociationActions.clear();
+      return true;
+   }
+}

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AnybodyPrincipal.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/AnybodyPrincipal.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AnybodyPrincipal.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,82 +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.security.Principal;
-
-/** An implementation of Principal and Comparable that represents any role.
-Any Principal or name of a Principal when compared to an AnybodyPrincipal
-using {@link #equals(Object) equals} or {@link #compareTo(Object) compareTo} 
-will always be found equals to the AnybodyPrincipal.
-
-Note that this class is not likely to operate correctly in a collection
-since the hashCode() and equals() methods are not correlated.
-
- at author Scott.Stark at jboss.org
- at version $Revision$
-*/
-public class AnybodyPrincipal implements Comparable, Principal
-{
-    public static final String ANYBODY = "<ANYBODY>";
-    public static final AnybodyPrincipal ANYBODY_PRINCIPAL = new AnybodyPrincipal();
-
-    public int hashCode()
-    {
-        return ANYBODY.hashCode();
-    }
-
-    /**
-    @return "<ANYBODY>"
-    */
-    public String getName()
-    {
-        return ANYBODY;
-    }
-
-    public String toString()
-    {
-        return ANYBODY;
-    }
-    
-    /** This method always returns 0 to indicate equality for any argument.
-    This is only meaningful when comparing against other Principal objects
-     or names of Principals.
-
-    @return true to indicate equality for any argument.
-    */
-    public boolean equals(Object another)
-    {
-        return true;
-    }
-
-    /** This method always returns 0 to indicate equality for any argument.
-    This is only meaningful when comparing against other Principal objects
-     or names of Principals.
-
-    @return 0 to indicate equality for any argument.
-    */
-    public int compareTo(Object o)
-    {
-        return 0;
-    }
-
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AnybodyPrincipal.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/AnybodyPrincipal.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AnybodyPrincipal.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AnybodyPrincipal.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,82 @@
+/*
+* 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.security.Principal;
+
+/** An implementation of Principal and Comparable that represents any role.
+Any Principal or name of a Principal when compared to an AnybodyPrincipal
+using {@link #equals(Object) equals} or {@link #compareTo(Object) compareTo} 
+will always be found equals to the AnybodyPrincipal.
+
+Note that this class is not likely to operate correctly in a collection
+since the hashCode() and equals() methods are not correlated.
+
+ at author Scott.Stark at jboss.org
+ at version $Revision$
+*/
+public class AnybodyPrincipal implements Comparable<Object>, Principal
+{
+    public static final String ANYBODY = "<ANYBODY>";
+    public static final AnybodyPrincipal ANYBODY_PRINCIPAL = new AnybodyPrincipal();
+
+    public int hashCode()
+    {
+        return ANYBODY.hashCode();
+    }
+
+    /**
+    @return "<ANYBODY>"
+    */
+    public String getName()
+    {
+        return ANYBODY;
+    }
+
+    public String toString()
+    {
+        return ANYBODY;
+    }
+    
+    /** This method always returns 0 to indicate equality for any argument.
+    This is only meaningful when comparing against other Principal objects
+     or names of Principals.
+
+    @return true to indicate equality for any argument.
+    */
+    public boolean equals(Object another)
+    {
+        return true;
+    }
+
+    /** This method always returns 0 to indicate equality for any argument.
+    This is only meaningful when comparing against other Principal objects
+     or names of Principals.
+
+    @return 0 to indicate equality for any argument.
+    */
+    public int compareTo(Object o)
+    {
+        return 0;
+    }
+
+}

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AuthorizationInfo.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/AuthorizationInfo.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AuthorizationInfo.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,194 +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.security.CodeSource;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.Principal;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.security.auth.Subject;
-
-/**
-
- at author Scott.Stark at jboss.org
- at version $Revision$
-*/
-public class AuthorizationInfo
-{
-    private static Set emptySet = new HashSet();
-    private ArrayList policyMap = new ArrayList();
-    private PolicyEntry[] policyEntries;
-
-    /** An inner class that represents a grant entry in policyMap. It is composed
-     *of a CodeSource and an array of Prinicpals along with the granted
-     *permissions.
-     */
-    static class PolicyEntry
-    {
-        private CodeSource cs;
-        private Principal[] principals;
-        private ArrayList permissions;
-
-        PolicyEntry(CodeSource cs, Principal[] principals, ArrayList permissions)
-        {
-            this.cs = cs;
-            this.principals = principals;
-            this.permissions = permissions;
-        }
-
-        public void getPermissions(PermissionCollection perms)
-        {
-            int length = permissions == null ? 0 : permissions.size();
-            for(int n = 0; n < length; n ++)
-            {
-                Permission permission = (Permission) permissions.get(n);
-                perms.add(permission);
-            }
-        }
-
-        public boolean implies(CodeSource codesrc, Set subjectPrincipals)
-        {
-            boolean implies = false;
-            // Check codesources
-            if( this.cs == codesrc )
-            {   // Both null or the same object
-                implies = true;
-            }
-            else if( this.cs != null && codesrc != null && this.cs.implies(codesrc) )
-            {
-                implies = true;
-            }
-
-            // Check Principals
-            if( implies == true )
-            {
-                if( this.principals != null )
-                {   // Every one of our principals must be in subjectPrincipals
-                    for(int p = 0; p < this.principals.length; p ++)
-                    {
-                        if( subjectPrincipals.contains(this.principals[p]) == false )
-                        {
-                            implies = false;
-                            break;
-                        }
-                    }
-                }
-            }
-
-            return implies;
-        }
-        public boolean equals(Object obj)
-        {
-            PolicyEntry key = (PolicyEntry) obj;
-            boolean equals = this.cs == key.cs;
-            if( equals == false )
-            {
-                if( this.cs != null && key.cs != null )
-                    equals = this.cs.equals(key.cs);
-                if( equals == true )
-                {   // Every principal in this must equal 
-                    if( this.principals != null && key.principals != null && this.principals.length == key.principals.length )
-                    {
-                        for(int p = 0; p < this.principals.length; p ++)
-                        {
-                            if( this.principals[p].equals(key.principals[p]) == false )
-                            {
-                                equals = false;
-                                break;
-                            }
-                        }
-                    }
-                    else if( this.principals != null || key.principals != null )
-                    {
-                        equals = false;
-                    }
-                }
-            }
-            return equals;
-        }
-        public int hashCode()
-        {
-            int hashCode = 0;
-            if( cs != null )
-                hashCode = cs.hashCode();
-            int length = (this.principals == null ? 0 : this.principals.length);
-            for(int p = 0; p < length; p ++)
-            {
-                hashCode += this.principals[p].hashCode();
-            }
-            return hashCode;
-        }
-
-        public String toString()
-        {
-            StringBuffer buffer = new StringBuffer();
-            buffer.append("cs=");
-            buffer.append(cs);
-            buffer.append("; principals=");
-            for(int p = 0; principals != null && p < principals.length; p ++)
-                buffer.append(principals[p]);
-            buffer.append("; permissions=");
-            buffer.append(permissions);
-            return buffer.toString();
-        }
-    }
-
-    public AuthorizationInfo()
-    {
-    }
-
-	public PermissionCollection getPermissions(Subject subject, CodeSource codesource)
-	{
-		PermissionCollection perms = new Permissions();
-        Set subjectPrincipals = emptySet;
-        if( subject != null )
-            subjectPrincipals = subject.getPrincipals();
-        for(int n = 0; n < policyMap.size(); n ++)
-        {
-            PolicyEntry entry = (PolicyEntry) policyMap.get(n);
-            if( entry.implies(codesource, subjectPrincipals) == true )
-                entry.getPermissions(perms);
-        }
-		return perms;
-	}
-
-    public String toString()
-    {
-        StringBuffer buffer = new StringBuffer("permissions:");
-        return buffer.toString();
-    }
-
-    public void grant(CodeSource cs, ArrayList permissions)
-    {
-        grant(cs, permissions, null);
-    }
-    public void grant(CodeSource cs, ArrayList permissions, Principal[] principals)
-    {
-        PolicyEntry entry = new PolicyEntry(cs, principals, permissions);
-        policyMap.add(entry);
-    }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AuthorizationInfo.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/AuthorizationInfo.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AuthorizationInfo.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/AuthorizationInfo.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,193 @@
+/*
+* 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.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+
+/**
+
+ at author Scott.Stark at jboss.org
+ at version $Revision$
+*/
+public class AuthorizationInfo
+{
+    private static Set<Principal> emptySet = new HashSet<Principal>();
+    private ArrayList<PolicyEntry> policyMap = new ArrayList<PolicyEntry>(); 
+
+    /** An inner class that represents a grant entry in policyMap. It is composed
+     *of a CodeSource and an array of Prinicpals along with the granted
+     *permissions.
+     */
+    static class PolicyEntry
+    {
+        private CodeSource cs;
+        private Principal[] principals;
+        private ArrayList<Permission> permissions;
+
+        PolicyEntry(CodeSource cs, Principal[] principals, ArrayList<Permission> permissions)
+        {
+            this.cs = cs;
+            this.principals = principals;
+            this.permissions = permissions;
+        }
+
+        public void getPermissions(PermissionCollection perms)
+        {
+            int length = permissions == null ? 0 : permissions.size();
+            for(int n = 0; n < length; n ++)
+            {
+                Permission permission = (Permission) permissions.get(n);
+                perms.add(permission);
+            }
+        }
+
+        public boolean implies(CodeSource codesrc, Set<Principal> subjectPrincipals)
+        {
+            boolean implies = false;
+            // Check codesources
+            if( this.cs == codesrc )
+            {   // Both null or the same object
+                implies = true;
+            }
+            else if( this.cs != null && codesrc != null && this.cs.implies(codesrc) )
+            {
+                implies = true;
+            }
+
+            // Check Principals
+            if( implies == true )
+            {
+                if( this.principals != null )
+                {   // Every one of our principals must be in subjectPrincipals
+                    for(int p = 0; p < this.principals.length; p ++)
+                    {
+                        if( subjectPrincipals.contains(this.principals[p]) == false )
+                        {
+                            implies = false;
+                            break;
+                        }
+                    }
+                }
+            }
+
+            return implies;
+        }
+        public boolean equals(Object obj)
+        {
+            PolicyEntry key = (PolicyEntry) obj;
+            boolean equals = this.cs == key.cs;
+            if( equals == false )
+            {
+                if( this.cs != null && key.cs != null )
+                    equals = this.cs.equals(key.cs);
+                if( equals == true )
+                {   // Every principal in this must equal 
+                    if( this.principals != null && key.principals != null && this.principals.length == key.principals.length )
+                    {
+                        for(int p = 0; p < this.principals.length; p ++)
+                        {
+                            if( this.principals[p].equals(key.principals[p]) == false )
+                            {
+                                equals = false;
+                                break;
+                            }
+                        }
+                    }
+                    else if( this.principals != null || key.principals != null )
+                    {
+                        equals = false;
+                    }
+                }
+            }
+            return equals;
+        }
+        public int hashCode()
+        {
+            int hashCode = 0;
+            if( cs != null )
+                hashCode = cs.hashCode();
+            int length = (this.principals == null ? 0 : this.principals.length);
+            for(int p = 0; p < length; p ++)
+            {
+                hashCode += this.principals[p].hashCode();
+            }
+            return hashCode;
+        }
+
+        public String toString()
+        {
+            StringBuffer buffer = new StringBuffer();
+            buffer.append("cs=");
+            buffer.append(cs);
+            buffer.append("; principals=");
+            for(int p = 0; principals != null && p < principals.length; p ++)
+                buffer.append(principals[p]);
+            buffer.append("; permissions=");
+            buffer.append(permissions);
+            return buffer.toString();
+        }
+    }
+
+    public AuthorizationInfo()
+    {
+    }
+
+	public PermissionCollection getPermissions(Subject subject, CodeSource codesource)
+	{
+		PermissionCollection perms = new Permissions();
+        Set<Principal> subjectPrincipals = emptySet;
+        if( subject != null )
+            subjectPrincipals = subject.getPrincipals();
+        for(int n = 0; n < policyMap.size(); n ++)
+        {
+            PolicyEntry entry = (PolicyEntry) policyMap.get(n);
+            if( entry.implies(codesource, subjectPrincipals) == true )
+                entry.getPermissions(perms);
+        }
+		return perms;
+	}
+
+    public String toString()
+    {
+        StringBuffer buffer = new StringBuffer("permissions:");
+        return buffer.toString();
+    }
+
+    public void grant(CodeSource cs, ArrayList<Permission> permissions)
+    {
+        grant(cs, permissions, null);
+    }
+    public void grant(CodeSource cs, ArrayList<Permission> permissions, Principal[] principals)
+    {
+        PolicyEntry entry = new PolicyEntry(cs, principals, permissions);
+        policyMap.add(entry);
+    }
+}

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/ClientLoginModule.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/ClientLoginModule.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/ClientLoginModule.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,284 +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 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 sharedState, Map 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();
-      }
-
-      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.pushSecurityContext(loginPrincipal, 
-                       loginCredential, subject, "CLIENT_LOGIN_MODULE");
-      // Set the login principal and credential and subject
-      //SecurityAssociationActions.setPrincipalInfo(loginPrincipal, loginCredential, subject);
-
-      // Add the login principal to the subject if is not there
-      Set 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.setSecurityContext(null);         
-      }
-      Set principals = subject.getPrincipals();
-      principals.remove(loginPrincipal);
-      return true;
-   }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/ClientLoginModule.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/ClientLoginModule.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/ClientLoginModule.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/ClientLoginModule.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,284 @@
+/*
+* 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();
+      }
+
+      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.pushSecurityContext(loginPrincipal, 
+                       loginCredential, subject, "CLIENT_LOGIN_MODULE");
+      // Set the login principal and credential and 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.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.setSecurityContext(null);         
+      }
+      Set<Principal> principals = subject.getPrincipals();
+      principals.remove(loginPrincipal);
+      return true;
+   }
+}

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestableGroup.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/NestableGroup.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestableGroup.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,165 +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.security.Principal;
-import java.security.acl.Group;
-import java.util.Enumeration;
-import java.util.LinkedList;
-
-//$Id$
-
-/** An implementation of Group that allows that acts as a stack of Groups
-with a single Group member active at any time.
-When one adds a Group to a NestableGroup the Group is pushed onto
-the active Group stack and any of the Group methods operate as though the
-NestableGroup contains only the Group. When removing the Group that
-corresponds to the active Group, the active Group is popped from the stack and
-the new active Group is set to the new top of the stack.
-
-The typical usage of this class is when doing a JAAS LoginContext login
-to runAs a new Principal with a new set of roles that should be added
-without destroying the current identity and roles.
-
- at author  Scott.Stark at jboss.org
- at version $Revision$
-*/
-public class NestableGroup extends SimplePrincipal implements Group, Cloneable 
-{
-    /** The serialVersionUID */
-   private static final long serialVersionUID = 1752783303935807441L;
-   /** The stack of the Groups. Elements are pushed/poped by
-        inserting/removing element 0.
-    */
-    private LinkedList<Principal> rolesStack;
-
-    /** Creates new NestableGroup with the given name
-    */
-    public NestableGroup(String name)
-    {
-        super(name);
-        rolesStack = new LinkedList();
-    }
-
-// --- Begin Group interface methods
-    /** Returns an enumeration that contains the single active Principal.
-    @return an Enumeration of the single active Principal.
-    */
-    public Enumeration<Principal> members()
-    {
-        return new IndexEnumeration();
-    }
-
-    /** Removes the first occurence of user from the Principal stack.
-
-    @param user the principal to remove from this group.
-    @return true if the principal was removed, or 
-     * false if the principal was not a member.
-    */
-    public boolean removeMember(Principal user)
-    {
-        return rolesStack.remove(user);
-    }
-
-    /** Pushes the group onto the Group stack and makes it the active
-        Group.
-    @param group the instance of Group that contains the roles to set as the
-        active Group.
-    @exception IllegalArgumentException thrown if group is not an instance of Group.
-    @return true always.
-    */
-    public boolean addMember(Principal group) throws IllegalArgumentException
-    {
-        if( (group instanceof Group) == false )
-            throw new IllegalArgumentException("The addMember argument must be a Group");
-
-        rolesStack.addFirst(group);
-        return true;
-    }
-
-    /** Returns true if the passed principal is a member of the active group.
-        This method does a recursive search, so if a principal belongs to a 
-        group which is a member of this group, true is returned.
-
-     @param member the principal whose membership is to be checked.
-
-     @return true if the principal is a member of this group, false otherwise.
-    */
-    public boolean isMember(Principal member)
-    {
-        if( rolesStack.size() == 0 )
-            return false;
-        Group activeGroup = (Group) rolesStack.getFirst();
-        boolean isMember = activeGroup.isMember(member);
-        return isMember;
-    }
-
-   public String toString()
-   {
-      StringBuffer tmp = new StringBuffer(getName());
-      tmp.append("(members:");
-      Enumeration iter = members();
-      while( iter.hasMoreElements() )
-      {
-         tmp.append(iter.nextElement());
-         tmp.append(',');
-      }
-      tmp.setCharAt(tmp.length()-1, ')');
-      return tmp.toString();
-   }
-   
-   public synchronized Object clone() throws CloneNotSupportedException   
-   {  
-      NestableGroup clone = (NestableGroup) super.clone(); 
-      if(clone != null) 
-        clone.rolesStack = (LinkedList<Principal>)this.rolesStack.clone();  
-      return clone; 
-   }
-   
-// --- End Group interface methods
-
-    private class IndexEnumeration implements Enumeration
-    {
-        private Enumeration iter;
-
-        IndexEnumeration()
-        {
-            if( rolesStack.size() > 0 )
-            {
-                Group grp = (Group) rolesStack.get(0);
-                iter = grp.members();
-            }
-        }
-        public boolean hasMoreElements()
-        {
-            boolean hasMore = iter != null && iter.hasMoreElements();
-            return hasMore;
-        }
-        public Object nextElement()
-        {
-            Object next = null;
-            if( iter != null )
-                next = iter.nextElement();
-            return next;
-        }
-    }
-}
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestableGroup.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/NestableGroup.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestableGroup.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestableGroup.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,166 @@
+/*
+* 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.security.Principal;
+import java.security.acl.Group;
+import java.util.Enumeration;
+import java.util.LinkedList;
+
+//$Id$
+
+/** An implementation of Group that allows that acts as a stack of Groups
+with a single Group member active at any time.
+When one adds a Group to a NestableGroup the Group is pushed onto
+the active Group stack and any of the Group methods operate as though the
+NestableGroup contains only the Group. When removing the Group that
+corresponds to the active Group, the active Group is popped from the stack and
+the new active Group is set to the new top of the stack.
+
+The typical usage of this class is when doing a JAAS LoginContext login
+to runAs a new Principal with a new set of roles that should be added
+without destroying the current identity and roles.
+
+ at author  Scott.Stark at jboss.org
+ at version $Revision$
+*/
+public class NestableGroup extends SimplePrincipal implements Group, Cloneable 
+{
+    /** The serialVersionUID */
+   private static final long serialVersionUID = 1752783303935807441L;
+   /** The stack of the Groups. Elements are pushed/poped by
+        inserting/removing element 0.
+    */
+    private LinkedList<Principal> rolesStack;
+
+    /** Creates new NestableGroup with the given name
+    */
+    public NestableGroup(String name)
+    {
+        super(name);
+        rolesStack = new LinkedList<Principal>();
+    }
+
+// --- Begin Group interface methods
+    /** Returns an enumeration that contains the single active Principal.
+    @return an Enumeration of the single active Principal.
+    */
+    public Enumeration<Principal> members()
+    {
+        return new IndexEnumeration<Principal>();
+    }
+
+    /** Removes the first occurence of user from the Principal stack.
+
+    @param user the principal to remove from this group.
+    @return true if the principal was removed, or 
+     * false if the principal was not a member.
+    */
+    public boolean removeMember(Principal user)
+    {
+        return rolesStack.remove(user);
+    }
+
+    /** Pushes the group onto the Group stack and makes it the active
+        Group.
+    @param group the instance of Group that contains the roles to set as the
+        active Group.
+    @exception IllegalArgumentException thrown if group is not an instance of Group.
+    @return true always.
+    */
+    public boolean addMember(Principal group) throws IllegalArgumentException
+    {
+        if( (group instanceof Group) == false )
+            throw new IllegalArgumentException("The addMember argument must be a Group");
+
+        rolesStack.addFirst(group);
+        return true;
+    }
+
+    /** Returns true if the passed principal is a member of the active group.
+        This method does a recursive search, so if a principal belongs to a 
+        group which is a member of this group, true is returned.
+
+     @param member the principal whose membership is to be checked.
+
+     @return true if the principal is a member of this group, false otherwise.
+    */
+    public boolean isMember(Principal member)
+    {
+        if( rolesStack.size() == 0 )
+            return false;
+        Group activeGroup = (Group) rolesStack.getFirst();
+        boolean isMember = activeGroup.isMember(member);
+        return isMember;
+    }
+
+   public String toString()
+   {
+      StringBuffer tmp = new StringBuffer(getName());
+      tmp.append("(members:");
+      Enumeration<Principal> iter = members();
+      while( iter.hasMoreElements() )
+      {
+         tmp.append(iter.nextElement());
+         tmp.append(',');
+      }
+      tmp.setCharAt(tmp.length()-1, ')');
+      return tmp.toString();
+   }
+   
+   @SuppressWarnings("unchecked")
+   public synchronized Object clone() throws CloneNotSupportedException   
+   {  
+      NestableGroup clone = (NestableGroup) super.clone(); 
+      if(clone != null) 
+        clone.rolesStack = (LinkedList<Principal>)this.rolesStack.clone();  
+      return clone; 
+   }
+   
+// --- End Group interface methods
+
+    private class IndexEnumeration<T extends Principal> implements Enumeration<Principal>
+    {
+        private Enumeration<? extends Principal> iter;
+
+        IndexEnumeration()
+        {
+            if( rolesStack.size() > 0 )
+            {
+                Group grp = (Group) rolesStack.get(0);
+                iter = grp.members();
+            }
+        }
+        public boolean hasMoreElements()
+        {
+            boolean hasMore = iter != null && iter.hasMoreElements();
+            return hasMore;
+        }
+        public Principal nextElement()
+        {
+            Principal next = null;
+            if( iter != null )
+                next = iter.nextElement();
+            return next;
+        }
+    }
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestablePrincipal.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/NestablePrincipal.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestablePrincipal.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,142 +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.security.Principal;
-import java.security.acl.Group;
-import java.util.Enumeration;
-import java.util.LinkedList;
-
-//$Id$
-
-/** An implementation of Group that allows that acts as a stack of Principals
-with a single Principal Group member active at any time.
-When one adds a Principal to a NestablePrincipal the Principal is pushed onto
-the active Princpal stack and any of the Group methods operate as though the
-Group contains only the Principal. When removing the Principal that corresponds
-to the active Principal, the active Principal is popped from the stack and
-the new active Principal is effectively set to the new top of the stack.
-
-The typical usage of this class is when doing a JAAS LoginContext login
-to runAs a new Principal with a new CallerPrincipal identity
-without destroying the current CallerPrincipal identity and roles.
-
- at author  Scott.Stark at jboss.org
- at version $Revision$
-*/
-public class NestablePrincipal extends SimplePrincipal implements Group, Cloneable
-{
-    /** The serialVersionUID */
-   private static final long serialVersionUID = 4628473920470890923L;
-   
-   /** The stack of the Principals. Elements are pushed/poped by
-        inserting/removing element 0.
-    */
-    private LinkedList<Principal> principalStack;
-
-    /** Creates new NestablePrincipal with the given name
-    */
-    public NestablePrincipal(String name)
-    {
-        super(name);
-        principalStack = new LinkedList<Principal>();
-    }
-
-// --- Begin Group interface methods
-    /** Returns an enumeration that contains the single active Principal.
-    @return an Enumeration of the single active Principal.
-    */
-    public Enumeration<Principal> members()
-    {
-        return new IndexEnumeration();
-    }
-
-    /** Removes the first occurence of user from the Principal stack.
-
-    @param user the principal to remove from this group.
-    @return true if the principal was removed, or 
-     * false if the principal was not a member.
-    */
-    public boolean removeMember(Principal user)
-    {
-        return principalStack.remove(user);
-    }
-
-    /** Pushes the user onto the Principal stack and makes it the active
-        Principal.
-    @return true always.
-    */
-    public boolean addMember(Principal user)
-    {
-        principalStack.addFirst(user);
-        return true;
-    }
-
-    /**
-     * Returns true if the passed principal is a member of the group. 
-     * This method does a recursive search, so if a principal belongs to a 
-     * group which is a member of this group, true is returned.
-     *
-     * @param member the principal whose membership is to be checked.
-     *
-     * @return true if the principal is a member of this group, 
-     * false otherwise.
-     */
-    public boolean isMember(Principal member)
-    {
-        if( principalStack.size() == 0 )
-            return false;
-
-        Object activePrincipal = principalStack.getFirst();
-        return member.equals(activePrincipal);
-    }
-    
-    public synchronized Object clone() throws CloneNotSupportedException    
-    {  
-       NestablePrincipal clone = (NestablePrincipal) super.clone(); 
-       if(clone != null) 
-         clone.principalStack = (LinkedList)this.principalStack.clone();  
-       return clone; 
-    } 
-    
-// --- End Group interface methods
-
-    private class IndexEnumeration implements Enumeration
-    {
-        private boolean hasMoreElements;
-
-        IndexEnumeration()
-        {
-            hasMoreElements = principalStack.size() > 0;
-        }
-        public boolean hasMoreElements()
-        {
-            return hasMoreElements;
-        }
-        public Object nextElement()
-        {
-            Object next = principalStack.getFirst();
-            hasMoreElements = false;
-            return next;
-        }
-    }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestablePrincipal.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/NestablePrincipal.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestablePrincipal.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NestablePrincipal.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,143 @@
+/*
+* 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.security.Principal;
+import java.security.acl.Group;
+import java.util.Enumeration;
+import java.util.LinkedList;
+
+//$Id$
+
+/** An implementation of Group that allows that acts as a stack of Principals
+with a single Principal Group member active at any time.
+When one adds a Principal to a NestablePrincipal the Principal is pushed onto
+the active Princpal stack and any of the Group methods operate as though the
+Group contains only the Principal. When removing the Principal that corresponds
+to the active Principal, the active Principal is popped from the stack and
+the new active Principal is effectively set to the new top of the stack.
+
+The typical usage of this class is when doing a JAAS LoginContext login
+to runAs a new Principal with a new CallerPrincipal identity
+without destroying the current CallerPrincipal identity and roles.
+
+ at author  Scott.Stark at jboss.org
+ at version $Revision$
+*/
+public class NestablePrincipal extends SimplePrincipal implements Group, Cloneable
+{
+    /** The serialVersionUID */
+   private static final long serialVersionUID = 4628473920470890923L;
+   
+   /** The stack of the Principals. Elements are pushed/poped by
+        inserting/removing element 0.
+    */
+    private LinkedList<Principal> principalStack;
+
+    /** Creates new NestablePrincipal with the given name
+    */
+    public NestablePrincipal(String name)
+    {
+        super(name);
+        principalStack = new LinkedList<Principal>();
+    }
+
+// --- Begin Group interface methods
+    /** Returns an enumeration that contains the single active Principal.
+    @return an Enumeration of the single active Principal.
+    */
+    public Enumeration<Principal> members()
+    {
+        return new IndexEnumeration<Principal>();
+    }
+
+    /** Removes the first occurence of user from the Principal stack.
+
+    @param user the principal to remove from this group.
+    @return true if the principal was removed, or 
+     * false if the principal was not a member.
+    */
+    public boolean removeMember(Principal user)
+    {
+        return principalStack.remove(user);
+    }
+
+    /** Pushes the user onto the Principal stack and makes it the active
+        Principal.
+    @return true always.
+    */
+    public boolean addMember(Principal user)
+    {
+        principalStack.addFirst(user);
+        return true;
+    }
+
+    /**
+     * Returns true if the passed principal is a member of the group. 
+     * This method does a recursive search, so if a principal belongs to a 
+     * group which is a member of this group, true is returned.
+     *
+     * @param member the principal whose membership is to be checked.
+     *
+     * @return true if the principal is a member of this group, 
+     * false otherwise.
+     */
+    public boolean isMember(Principal member)
+    {
+        if( principalStack.size() == 0 )
+            return false;
+
+        Object activePrincipal = principalStack.getFirst();
+        return member.equals(activePrincipal);
+    }
+    
+    @SuppressWarnings("unchecked")
+   public synchronized Object clone() throws CloneNotSupportedException    
+    {  
+       NestablePrincipal clone = (NestablePrincipal) super.clone(); 
+       if(clone != null) 
+         clone.principalStack = (LinkedList)this.principalStack.clone();  
+       return clone; 
+    } 
+    
+// --- End Group interface methods
+
+    private class IndexEnumeration<T extends Principal> implements Enumeration<Principal>
+    {
+        private boolean hasMoreElements;
+
+        IndexEnumeration()
+        {
+            hasMoreElements = principalStack.size() > 0;
+        }
+        public boolean hasMoreElements()
+        {
+            return hasMoreElements;
+        }
+        public Principal nextElement()
+        {
+            Principal next = principalStack.getFirst();
+            hasMoreElements = false;
+            return next;
+        }
+    }
+}

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NobodyPrincipal.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/NobodyPrincipal.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NobodyPrincipal.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,82 +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.security.Principal;
-
-/** An implementation of Principal and Comparable that represents no role.
-Any Principal or name of a Principal when compared to an NobodyPrincipal
-using {@link #equals(Object) equals} or {@link #compareTo(Object) compareTo} 
-will always be found not equal to the NobodyPrincipal.
-
-Note that this class is not likely to operate correctly in a collection
-since the hashCode() and equals() methods are not correlated.
-
- at author Scott.Stark at jboss.org
- at version $Revision$
-*/
-public class NobodyPrincipal implements Comparable, Principal
-{
-    public static final String NOBODY = "<NOBODY>";
-    public static final NobodyPrincipal NOBODY_PRINCIPAL = new NobodyPrincipal();
-
-    public int hashCode()
-    {
-        return NOBODY.hashCode();
-    }
-
-    /**
-    @return "<NOBODY>"
-    */
-    public String getName()
-    {
-        return NOBODY;
-    }
-
-    public String toString()
-    {
-        return NOBODY;
-    }
-    
-    /** This method always returns 0 to indicate equality for any argument.
-    This is only meaningful when comparing against other Principal objects
-     or names of Principals.
-
-    @return false to indicate inequality for any argument.
-    */
-    public boolean equals(Object another)
-    {
-        return false;
-    }
-
-    /** This method always returns 1 to indicate inequality for any argument.
-    This is only meaningful when comparing against other Principal objects
-     or names of Principals.
-
-    @return 1 to indicate inequality for any argument.
-    */
-    public int compareTo(Object o)
-    {
-        return 1;
-    }
-
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NobodyPrincipal.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/NobodyPrincipal.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NobodyPrincipal.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/NobodyPrincipal.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,82 @@
+/*
+* 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.security.Principal;
+
+/** An implementation of Principal and Comparable that represents no role.
+Any Principal or name of a Principal when compared to an NobodyPrincipal
+using {@link #equals(Object) equals} or {@link #compareTo(Object) compareTo} 
+will always be found not equal to the NobodyPrincipal.
+
+Note that this class is not likely to operate correctly in a collection
+since the hashCode() and equals() methods are not correlated.
+
+ at author Scott.Stark at jboss.org
+ at version $Revision$
+*/
+public class NobodyPrincipal implements Comparable<Object>, Principal
+{
+    public static final String NOBODY = "<NOBODY>";
+    public static final NobodyPrincipal NOBODY_PRINCIPAL = new NobodyPrincipal();
+
+    public int hashCode()
+    {
+        return NOBODY.hashCode();
+    }
+
+    /**
+    @return "<NOBODY>"
+    */
+    public String getName()
+    {
+        return NOBODY;
+    }
+
+    public String toString()
+    {
+        return NOBODY;
+    }
+    
+    /** This method always returns 0 to indicate equality for any argument.
+    This is only meaningful when comparing against other Principal objects
+     or names of Principals.
+
+    @return false to indicate inequality for any argument.
+    */
+    public boolean equals(Object another)
+    {
+        return false;
+    }
+
+    /** This method always returns 1 to indicate inequality for any argument.
+    This is only meaningful when comparing against other Principal objects
+     or names of Principals.
+
+    @return 1 to indicate inequality for any argument.
+    */
+    public int compareTo(Object o)
+    {
+        return 1;
+    }
+
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/RunAsIdentity.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/RunAsIdentity.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/RunAsIdentity.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,167 +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.security.Principal;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-//$Id$
-
-/**
- * The RunAsIdentity is a Principal that associates the run-as principal
- * with his run-as role(s).
- *
- * @author Thomas.Diesler at jboss.org
- * @author Scott.Stark at jboss.org
- * @author Anil.Saldhana at jboss.org 
- * @version $Revision$
- */
-public class RunAsIdentity extends SimplePrincipal implements Cloneable, RunAs
-{
-   /** @since 4.0.2 */
-   private static final long serialVersionUID = -3236178735180485083L;
-
-   /** The run-as role principals */
-   private HashSet<Principal> runAsRoles = new HashSet<Principal>(); 
-   private HashSet<Principal> principalsSet; 
-
-   private static final String ANOYMOUS_PRINCIPAL = "anonymous";
-
-   /**
-    * Construct an inmutable instance of a RunAsIdentity
-    */
-   public RunAsIdentity(String roleName, String principalName)
-   {
-      // we don't support run-as credetials
-      super(principalName != null ? principalName : ANOYMOUS_PRINCIPAL);
-
-      if (roleName == null)
-         throw new IllegalArgumentException("The run-as identity must have at least one role");
-
-      runAsRoles.add(new SimplePrincipal(roleName));
-   }
-
-   /**
-    * Construct an inmutable instance of a RunAsIdentity
-    */
-   public RunAsIdentity(String roleName, String principalName, Set<String> extraRoleNames)
-   {
-      this(roleName, principalName);
-
-      // these come from the assembly-descriptor
-      if (extraRoleNames != null)
-      {
-         Iterator<String> it = extraRoleNames.iterator();
-         while (it.hasNext())
-         {
-            String extraRoleName = (String) it.next();
-            runAsRoles.add(new SimplePrincipal(extraRoleName));
-         }
-      }
-   }
-
-   /**
-    Return a set with the configured run-as role
-    @return Set<Principal> for the run-as roles
-    */
-   public Set<Principal> getRunAsRoles()
-   {
-      return new HashSet<Principal>(runAsRoles);
-   }
-    
-   /**
-    Return a set with the configured run-as principal and a Group("Roles")
-    with teh run-as roles
-
-    @return Set<Principal> for the run-as principal and roles
-    */
-   public synchronized Set<Principal> getPrincipalsSet()
-   {
-      if( principalsSet == null )
-      {
-         principalsSet = new HashSet<Principal>();
-         principalsSet.add(this);
-         SimpleGroup roles = new SimpleGroup("Roles");
-         principalsSet.add(roles);
-         Iterator<Principal> iter = runAsRoles.iterator();
-         while( iter.hasNext() )
-         {
-            Principal role = (Principal) iter.next();
-            roles.addMember(role);
-         }
-      }
-      return principalsSet;
-   }
-
-   public boolean doesUserHaveRole(Principal role)
-   {
-      return runAsRoles.contains(role);
-   }
-
-   /**
-    * True if the run-as principal has any of the method roles
-    */
-   public boolean doesUserHaveRole(Set<Principal> methodRoles)
-   {
-      Iterator<Principal> it = methodRoles.iterator();
-      while (it.hasNext())
-      {
-         Principal role = (Principal) it.next();
-         if (doesUserHaveRole(role))
-            return true;
-      }
-      return false;
-   }
-
-   /**
-    * Returns a string representation of the object.
-    * @return a string representation of the object.
-    */
-   public String toString()
-   {
-      return "[roles=" + runAsRoles + ",principal=" + getName() + "]";
-   }
-   
-   public synchronized Object clone() throws CloneNotSupportedException    
-   {  
-      RunAsIdentity clone = (RunAsIdentity) super.clone(); 
-      if(clone != null) 
-      { 
-         clone.principalsSet = principalsSet != null ?
-                   (HashSet<Principal>)this.principalsSet.clone() : null; 
-         clone.runAsRoles = (HashSet<Principal>)this.runAsRoles.clone(); 
-      }  
-      return clone; 
-   }
-
-   public <T> T getIdentity()
-   { 
-      return (T) getName();
-   }
-
-   public <T> T getProof()
-   { 
-      return (T) SecurityConstants.JAVAEE;
-   } 
-}
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/RunAsIdentity.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/RunAsIdentity.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/RunAsIdentity.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/RunAsIdentity.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,170 @@
+/*
+* 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.security.Principal;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+//$Id$
+
+/**
+ * The RunAsIdentity is a Principal that associates the run-as principal
+ * with his run-as role(s).
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @author Scott.Stark at jboss.org
+ * @author Anil.Saldhana at jboss.org 
+ * @version $Revision$
+ */
+public class RunAsIdentity extends SimplePrincipal implements Cloneable, RunAs
+{
+   /** @since 4.0.2 */
+   private static final long serialVersionUID = -3236178735180485083L;
+
+   /** The run-as role principals */
+   private HashSet<Principal> runAsRoles = new HashSet<Principal>(); 
+   private HashSet<Principal> principalsSet; 
+
+   private static final String ANOYMOUS_PRINCIPAL = "anonymous";
+
+   /**
+    * Construct an inmutable instance of a RunAsIdentity
+    */
+   public RunAsIdentity(String roleName, String principalName)
+   {
+      // we don't support run-as credetials
+      super(principalName != null ? principalName : ANOYMOUS_PRINCIPAL);
+
+      if (roleName == null)
+         throw new IllegalArgumentException("The run-as identity must have at least one role");
+
+      runAsRoles.add(new SimplePrincipal(roleName));
+   }
+
+   /**
+    * Construct an inmutable instance of a RunAsIdentity
+    */
+   public RunAsIdentity(String roleName, String principalName, Set<String> extraRoleNames)
+   {
+      this(roleName, principalName);
+
+      // these come from the assembly-descriptor
+      if (extraRoleNames != null)
+      {
+         Iterator<String> it = extraRoleNames.iterator();
+         while (it.hasNext())
+         {
+            String extraRoleName = (String) it.next();
+            runAsRoles.add(new SimplePrincipal(extraRoleName));
+         }
+      }
+   }
+
+   /**
+    Return a set with the configured run-as role
+    @return Set<Principal> for the run-as roles
+    */
+   public Set<Principal> getRunAsRoles()
+   {
+      return new HashSet<Principal>(runAsRoles);
+   }
+    
+   /**
+    Return a set with the configured run-as principal and a Group("Roles")
+    with teh run-as roles
+
+    @return Set<Principal> for the run-as principal and roles
+    */
+   public synchronized Set<Principal> getPrincipalsSet()
+   {
+      if( principalsSet == null )
+      {
+         principalsSet = new HashSet<Principal>();
+         principalsSet.add(this);
+         SimpleGroup roles = new SimpleGroup("Roles");
+         principalsSet.add(roles);
+         Iterator<Principal> iter = runAsRoles.iterator();
+         while( iter.hasNext() )
+         {
+            Principal role = (Principal) iter.next();
+            roles.addMember(role);
+         }
+      }
+      return principalsSet;
+   }
+
+   public boolean doesUserHaveRole(Principal role)
+   {
+      return runAsRoles.contains(role);
+   }
+
+   /**
+    * True if the run-as principal has any of the method roles
+    */
+   public boolean doesUserHaveRole(Set<Principal> methodRoles)
+   {
+      Iterator<Principal> it = methodRoles.iterator();
+      while (it.hasNext())
+      {
+         Principal role = (Principal) it.next();
+         if (doesUserHaveRole(role))
+            return true;
+      }
+      return false;
+   }
+
+   /**
+    * Returns a string representation of the object.
+    * @return a string representation of the object.
+    */
+   public String toString()
+   {
+      return "[roles=" + runAsRoles + ",principal=" + getName() + "]";
+   }
+   
+   @SuppressWarnings("unchecked")
+   public synchronized Object clone() throws CloneNotSupportedException    
+   {  
+      RunAsIdentity clone = (RunAsIdentity) super.clone(); 
+      if(clone != null) 
+      { 
+         clone.principalsSet = principalsSet != null ?
+                   (HashSet<Principal>)this.principalsSet.clone() : null; 
+         clone.runAsRoles = (HashSet<Principal>)this.runAsRoles.clone(); 
+      }  
+      return clone; 
+   }
+
+   @SuppressWarnings("unchecked")
+   public <T> T getIdentity()
+   { 
+      return (T) getName();
+   }
+
+   @SuppressWarnings("unchecked")
+   public <T> T getProof()
+   { 
+      return (T) SecurityConstants.JAVAEE;
+   } 
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/SecurityActions.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/SecurityActions.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/SecurityActions.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,81 +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.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Priviledged actions for this package
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-class SecurityActions
-{
-   interface SystemPropertyAction
-   {
-      SystemPropertyAction PRIVILEGED = new SystemPropertyAction()
-      {
-         public String getProperty(final String name, final String defaultValue)
-         {
-            String prop = (String) AccessController.doPrivileged(
-               new PrivilegedAction()
-               {
-                  public Object run()
-                  {
-                     String p = System.getProperty(name, defaultValue);
-                     return p;
-                  }
-               }
-            );
-            return prop;
-         }
-      };
-
-      SystemPropertyAction NON_PRIVILEGED = new SystemPropertyAction()
-      {
-         public String getProperty(final String name, final String defaultValue)
-         {
-            String prop = System.getProperty(name, defaultValue);
-            return prop;
-         }
-      };
-
-      String getProperty(final String name, final String defaultValue);
-   }
-
-   static String getProperty(final String name, final String defaultValue)
-   {
-      SecurityManager sm = System.getSecurityManager();
-      String prop;
-      if( sm != null )
-      {
-         prop = SystemPropertyAction.PRIVILEGED.getProperty(name, defaultValue);
-      }
-      else
-      {
-         prop = SystemPropertyAction.NON_PRIVILEGED.getProperty(name, defaultValue);
-      }
-      return prop;
-   }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/SecurityActions.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/SecurityActions.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/SecurityActions.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/SecurityActions.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,81 @@
+/*
+* 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.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Priviledged actions for this package
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+class SecurityActions
+{
+   interface SystemPropertyAction
+   {
+      SystemPropertyAction PRIVILEGED = new SystemPropertyAction()
+      {
+         public String getProperty(final String name, final String defaultValue)
+         {
+            String prop = AccessController.doPrivileged(
+               new PrivilegedAction<String>()
+               {
+                  public String run()
+                  {
+                     String p = System.getProperty(name, defaultValue);
+                     return p;
+                  }
+               }
+            );
+            return prop;
+         }
+      };
+
+      SystemPropertyAction NON_PRIVILEGED = new SystemPropertyAction()
+      {
+         public String getProperty(final String name, final String defaultValue)
+         {
+            String prop = System.getProperty(name, defaultValue);
+            return prop;
+         }
+      };
+
+      String getProperty(final String name, final String defaultValue);
+   }
+
+   static String getProperty(final String name, final String defaultValue)
+   {
+      SecurityManager sm = System.getSecurityManager();
+      String prop;
+      if( sm != null )
+      {
+         prop = SystemPropertyAction.PRIVILEGED.getProperty(name, defaultValue);
+      }
+      else
+      {
+         prop = SystemPropertyAction.NON_PRIVILEGED.getProperty(name, defaultValue);
+      }
+      return prop;
+   }
+}

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/audit/config/AuditConfigEntryHolder.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/audit/config/AuditConfigEntryHolder.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/audit/config/AuditConfigEntryHolder.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,78 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2007, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.security.audit.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.security.auth.login.ModuleOption;
-import org.jboss.xb.binding.GenericValueContainer;
-
-//$Id$
-
-/**
- *  A container for creating AuditConfigEntry during jbxb parse
- *  @author Anil.Saldhana at redhat.com
- *  @since  Aug 14, 2007 
- *  @version $Revision$
- */
-public class AuditConfigEntryHolder implements GenericValueContainer
-{
-   private Map moduleOptions = new HashMap();
-   String moduleName = null; 
-   
-   public void addChild(QName name, Object value)
-   {
-      if("code".equals(name.getLocalPart()))
-      {
-         moduleName = (String)value; 
-      } 
-      if(value instanceof ModuleOption)
-      {
-         ModuleOption mo = (ModuleOption)value;
-         moduleOptions.put(mo.getName(),mo.getValue());
-      }  
-   }
-
-   public void addOption(ModuleOption option)
-   {
-      moduleOptions.put(option.getName(), option.getValue());
-   }
-   
-   public AuditProviderEntry getEntry()
-   { 
-      return (AuditProviderEntry)instantiate();
-   }
-   
-   public Object instantiate()
-   { 
-      AuditProviderEntry entry = new AuditProviderEntry( moduleName,moduleOptions ); 
-      return entry;
-   }
-   
-   public Class getTargetClass()
-   { 
-      return AuditProviderEntry.class;
-   } 
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/audit/config/AuditConfigEntryHolder.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/audit/config/AuditConfigEntryHolder.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/audit/config/AuditConfigEntryHolder.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/audit/config/AuditConfigEntryHolder.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,78 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.audit.config;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.security.auth.login.ModuleOption;
+import org.jboss.xb.binding.GenericValueContainer;
+
+//$Id$
+
+/**
+ *  A container for creating AuditConfigEntry during jbxb parse
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Aug 14, 2007 
+ *  @version $Revision$
+ */
+public class AuditConfigEntryHolder implements GenericValueContainer
+{
+   private Map<String,Object> moduleOptions = new HashMap<String,Object>();
+   String moduleName = null; 
+   
+   public void addChild(QName name, Object value)
+   {
+      if("code".equals(name.getLocalPart()))
+      {
+         moduleName = (String)value; 
+      } 
+      if(value instanceof ModuleOption)
+      {
+         ModuleOption mo = (ModuleOption)value;
+         moduleOptions.put(mo.getName(),mo.getValue());
+      }  
+   }
+
+   public void addOption(ModuleOption option)
+   {
+      moduleOptions.put(option.getName(), option.getValue());
+   }
+   
+   public AuditProviderEntry getEntry()
+   { 
+      return (AuditProviderEntry)instantiate();
+   }
+   
+   public Object instantiate()
+   { 
+      AuditProviderEntry entry = new AuditProviderEntry( moduleName,moduleOptions ); 
+      return entry;
+   }
+   
+   public Class<?> getTargetClass()
+   { 
+      return AuditProviderEntry.class;
+   } 
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/AppCallbackHandler.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/AppCallbackHandler.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/AppCallbackHandler.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,297 +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.callback;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.lang.reflect.Method;
-import java.security.Principal;
-import java.util.Iterator;
-import java.util.Map;
-
-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.TextInputCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-//$Id$
-
-/** 
- * JBAS-3109:AppCallbackHandler as the default CallbackHandler in the 
- * security module
- * 
- * An implementation of the JAAS CallbackHandler interface that 
- * handles NameCallbacks, PasswordCallback, TextInputCallback 
- * and the JBoss ByteArrayCallback.
- * All JBoss Callbacks must be handled.
- * - MapCallback
- * 
- * @see javax.security.auth.callback.CallbackHandler
- * @see #handle(Callback[])
- * 
- * @author Scott.Stark at jboss.org
- * @author Anil.Saldhana at jboss.org
- * @version $Revision$
- */
-public class AppCallbackHandler implements CallbackHandler
-{
-   private String username;
-   private char[] password;
-   private byte[] data;
-   private String text; 
-   
-   private transient String prompt;
-   private transient Object credential;
-   
-   private Map keyValuePair;  
-   
-   /** Whether this handler gets the username/password from the console */
-   private boolean consoleHandler = false; 
-
-   public AppCallbackHandler()
-   {   
-   }
-   
-   public AppCallbackHandler(String username, char[] password)
-   {
-      this.username = username;
-      this.password = password;
-   }
-   public AppCallbackHandler(String username, char[] password, byte[] data)
-   {
-      this.username = username;
-      this.password = password;
-      this.data = data;
-   }
-   public AppCallbackHandler(String username, char[] password, byte[] data, String text)
-   {
-      this.username = username;
-      this.password = password;
-      this.data = data;
-      this.text = text;
-   } 
-   
-   /**
-    * 
-    * Create a new AppCallbackHandler.
-    * 
-    * @param isConsoleHandler Denotes whether the input is from
-    *                         the console.
-    */
-   public AppCallbackHandler(boolean isConsoleHandler)
-   {
-      this.consoleHandler = isConsoleHandler; 
-   } 
-   
-   /**
-    * 
-    * Create a new AppCallbackHandler.
-    * 
-    * @param prompt Prompt meaningful to the LoginModule
-    */
-   public AppCallbackHandler(String prompt)
-   {
-       this.prompt = prompt;
-   }
-   
-   /**
-    * 
-    * Create a new AppCallbackHandler.
-    * 
-    * @param mapOfValues Key Value Pair
-    */
-   public AppCallbackHandler(Map mapOfValues)
-   { 
-      this.keyValuePair = mapOfValues;
-   }
-   
-   public void setSecurityInfo(Principal p, Object cred)
-   {
-      this.username = p.getName();
-      this.credential = cred;
-   }
-
-   public String getPrompt()
-   {
-       return prompt;
-   }
-   public Object getCredential()
-   {
-       return credential;
-   }
-   public void setCredential(Object credential)
-   {
-       this.credential = credential;
-   }
-   public void clearCredential()
-   {
-       this.credential = null;
-   } 
-
-   public void handle(Callback[] callbacks) throws
-         IOException, UnsupportedCallbackException
-   {
-      for (int i = 0; i < callbacks.length; i++)
-      {
-         Callback c = callbacks[i]; 
-         if( c instanceof NameCallback )
-         {
-            NameCallback nc = (NameCallback) c; 
-            String prompt = nc.getPrompt();
-            if( prompt == null )
-               prompt = "Enter Username: ";
-            if(this.consoleHandler)
-               nc.setName(getUserNameFromConsole(prompt));
-            else
-               nc.setName(username);
-         }
-         else if( c instanceof PasswordCallback )
-         {
-            PasswordCallback pc = (PasswordCallback) c;
-            String prompt = pc.getPrompt();
-            if( prompt == null )
-               prompt = "Enter Password: ";
-            if(this.consoleHandler)
-               pc.setPassword(getPasswordFromConsole(prompt));
-            else
-               if(this.credential != null && this.password == null)
-                  pc.setPassword(this.getPassword());
-            else
-               pc.setPassword(password);
-         }
-         else if( c instanceof TextInputCallback )
-         {
-            TextInputCallback tc = (TextInputCallback) c;
-            tc.setText(text);
-         }
-         else if( c instanceof ByteArrayCallback )
-         {
-            ByteArrayCallback bac = (ByteArrayCallback) c;
-            bac.setByteArray(data);
-         }
-         else if (c instanceof ObjectCallback)
-         {
-            ObjectCallback oc = (ObjectCallback) c;
-            oc.setCredential(credential);
-         }
-         else if( c instanceof MapCallback )
-         {
-            MapCallback mc = (MapCallback) c;
-            if(keyValuePair != null && !keyValuePair.isEmpty())
-            {
-               Iterator iter = keyValuePair.keySet().iterator();
-               while(iter.hasNext())
-               {
-                  Object key = iter.next();
-                  if(key instanceof String == false)
-                     throw new SecurityException("key is not a String");
-                  mc.setInfo((String)key, keyValuePair.get(key));
-               }  
-            }
-         }
-         else
-         {
-            throw new UnsupportedCallbackException(c, "Unrecognized Callback");
-         }
-      }
-   }
-   
-   private String getUserNameFromConsole(String prompt)
-   {
-      String uName = "";
-      System.out.print(prompt);
-      InputStreamReader isr = new InputStreamReader(System.in);
-      BufferedReader br = new BufferedReader(isr);
-      try
-      {
-         uName = br.readLine(); 
-      }
-      catch(IOException e)
-      {
-         throw new SecurityException("Failed to obtain username, ioe="+e.getMessage());
-      }
-      return uName;
-   }
-   
-   private char[] getPasswordFromConsole(String prompt)
-   {
-      String pwd = "";
-      //Prompt the user for the username
-      System.out.print(prompt);
-      InputStreamReader isr = new InputStreamReader(System.in);
-      BufferedReader br = new BufferedReader(isr);
-      try
-      {
-         pwd = br.readLine();   
-      }
-      catch(IOException e)
-      {
-         throw new SecurityException("Failed to obtain password, ioe="+e.getMessage());
-      }
-      return pwd.toCharArray();
-   }
-   
-   /** Try to convert the credential value into a char[] using the
-   first of the following attempts which succeeds:
-
-   1. Check for instanceof char[]
-   2. Check for instanceof String and then use toCharArray()
-   3. See if credential has a toCharArray() method and use it
-   4. Use toString() followed by toCharArray().
-   @return a char[] representation of the credential.
-   */
-  private char[] getPassword()
-  {
-     char[] password = null;
-     if (credential instanceof char[])
-     {
-        password = (char[]) credential;
-     }
-     else if (credential instanceof String)
-     {
-        String s = (String) credential;
-        password = s.toCharArray();
-     }
-     else
-     {
-        try
-        {
-           Class[] types = {};
-           Method m = credential.getClass().getMethod("toCharArray", types);
-           Object[] args = {};
-           password = (char[]) m.invoke(credential, args);
-        }
-        catch (Exception e)
-        {
-           if (credential != null)
-           {
-              String s = credential.toString();
-              password = s.toCharArray();
-           }
-        }
-     }
-     return password;
-  }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/AppCallbackHandler.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/AppCallbackHandler.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/AppCallbackHandler.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/AppCallbackHandler.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,297 @@
+/*
+* 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.callback;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.reflect.Method;
+import java.security.Principal;
+import java.util.Iterator;
+import java.util.Map;
+
+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.TextInputCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+//$Id$
+
+/** 
+ * JBAS-3109:AppCallbackHandler as the default CallbackHandler in the 
+ * security module
+ * 
+ * An implementation of the JAAS CallbackHandler interface that 
+ * handles NameCallbacks, PasswordCallback, TextInputCallback 
+ * and the JBoss ByteArrayCallback.
+ * All JBoss Callbacks must be handled.
+ * - MapCallback
+ * 
+ * @see javax.security.auth.callback.CallbackHandler
+ * @see #handle(Callback[])
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author Anil.Saldhana at jboss.org
+ * @version $Revision$
+ */
+public class AppCallbackHandler implements CallbackHandler
+{
+   private String username;
+   private char[] password;
+   private byte[] data;
+   private String text; 
+   
+   private transient String prompt;
+   private transient Object credential;
+   
+   private Map<String,Object> keyValuePair;  
+   
+   /** Whether this handler gets the username/password from the console */
+   private boolean consoleHandler = false; 
+
+   public AppCallbackHandler()
+   {   
+   }
+   
+   public AppCallbackHandler(String username, char[] password)
+   {
+      this.username = username;
+      this.password = password;
+   }
+   public AppCallbackHandler(String username, char[] password, byte[] data)
+   {
+      this.username = username;
+      this.password = password;
+      this.data = data;
+   }
+   public AppCallbackHandler(String username, char[] password, byte[] data, String text)
+   {
+      this.username = username;
+      this.password = password;
+      this.data = data;
+      this.text = text;
+   } 
+   
+   /**
+    * 
+    * Create a new AppCallbackHandler.
+    * 
+    * @param isConsoleHandler Denotes whether the input is from
+    *                         the console.
+    */
+   public AppCallbackHandler(boolean isConsoleHandler)
+   {
+      this.consoleHandler = isConsoleHandler; 
+   } 
+   
+   /**
+    * 
+    * Create a new AppCallbackHandler.
+    * 
+    * @param prompt Prompt meaningful to the LoginModule
+    */
+   public AppCallbackHandler(String prompt)
+   {
+       this.prompt = prompt;
+   }
+   
+   /**
+    * 
+    * Create a new AppCallbackHandler.
+    * 
+    * @param mapOfValues Key Value Pair
+    */
+   public AppCallbackHandler(Map<String,Object> mapOfValues)
+   { 
+      this.keyValuePair = mapOfValues;
+   }
+   
+   public void setSecurityInfo(Principal p, Object cred)
+   {
+      this.username = p.getName();
+      this.credential = cred;
+   }
+
+   public String getPrompt()
+   {
+       return prompt;
+   }
+   public Object getCredential()
+   {
+       return credential;
+   }
+   public void setCredential(Object credential)
+   {
+       this.credential = credential;
+   }
+   public void clearCredential()
+   {
+       this.credential = null;
+   } 
+
+   public void handle(Callback[] callbacks) throws
+         IOException, UnsupportedCallbackException
+   {
+      for (int i = 0; i < callbacks.length; i++)
+      {
+         Callback c = callbacks[i]; 
+         if( c instanceof NameCallback )
+         {
+            NameCallback nc = (NameCallback) c; 
+            String prompt = nc.getPrompt();
+            if( prompt == null )
+               prompt = "Enter Username: ";
+            if(this.consoleHandler)
+               nc.setName(getUserNameFromConsole(prompt));
+            else
+               nc.setName(username);
+         }
+         else if( c instanceof PasswordCallback )
+         {
+            PasswordCallback pc = (PasswordCallback) c;
+            String prompt = pc.getPrompt();
+            if( prompt == null )
+               prompt = "Enter Password: ";
+            if(this.consoleHandler)
+               pc.setPassword(getPasswordFromConsole(prompt));
+            else
+               if(this.credential != null && this.password == null)
+                  pc.setPassword(this.getPassword());
+            else
+               pc.setPassword(password);
+         }
+         else if( c instanceof TextInputCallback )
+         {
+            TextInputCallback tc = (TextInputCallback) c;
+            tc.setText(text);
+         }
+         else if( c instanceof ByteArrayCallback )
+         {
+            ByteArrayCallback bac = (ByteArrayCallback) c;
+            bac.setByteArray(data);
+         }
+         else if (c instanceof ObjectCallback)
+         {
+            ObjectCallback oc = (ObjectCallback) c;
+            oc.setCredential(credential);
+         }
+         else if( c instanceof MapCallback )
+         {
+            MapCallback mc = (MapCallback) c;
+            if(keyValuePair != null && !keyValuePair.isEmpty())
+            {
+               Iterator<?> iter = keyValuePair.keySet().iterator();
+               while(iter.hasNext())
+               {
+                  Object key = iter.next();
+                  if(key instanceof String == false)
+                     throw new SecurityException("key is not a String");
+                  mc.setInfo((String)key, keyValuePair.get(key));
+               }  
+            }
+         }
+         else
+         {
+            throw new UnsupportedCallbackException(c, "Unrecognized Callback");
+         }
+      }
+   }
+   
+   private String getUserNameFromConsole(String prompt)
+   {
+      String uName = "";
+      System.out.print(prompt);
+      InputStreamReader isr = new InputStreamReader(System.in);
+      BufferedReader br = new BufferedReader(isr);
+      try
+      {
+         uName = br.readLine(); 
+      }
+      catch(IOException e)
+      {
+         throw new SecurityException("Failed to obtain username, ioe="+e.getMessage());
+      }
+      return uName;
+   }
+   
+   private char[] getPasswordFromConsole(String prompt)
+   {
+      String pwd = "";
+      //Prompt the user for the username
+      System.out.print(prompt);
+      InputStreamReader isr = new InputStreamReader(System.in);
+      BufferedReader br = new BufferedReader(isr);
+      try
+      {
+         pwd = br.readLine();   
+      }
+      catch(IOException e)
+      {
+         throw new SecurityException("Failed to obtain password, ioe="+e.getMessage());
+      }
+      return pwd.toCharArray();
+   }
+   
+   /** Try to convert the credential value into a char[] using the
+   first of the following attempts which succeeds:
+
+   1. Check for instanceof char[]
+   2. Check for instanceof String and then use toCharArray()
+   3. See if credential has a toCharArray() method and use it
+   4. Use toString() followed by toCharArray().
+   @return a char[] representation of the credential.
+   */
+  private char[] getPassword()
+  {
+     char[] password = null;
+     if (credential instanceof char[])
+     {
+        password = (char[]) credential;
+     }
+     else if (credential instanceof String)
+     {
+        String s = (String) credential;
+        password = s.toCharArray();
+     }
+     else
+     {
+        try
+        {
+           Class<?>[] types = {};
+           Method m = credential.getClass().getMethod("toCharArray", types);
+           Object[] args = {};
+           password = (char[]) m.invoke(credential, args);
+        }
+        catch (Exception e)
+        {
+           if (credential != null)
+           {
+              String s = credential.toString();
+              password = s.toCharArray();
+           }
+        }
+     }
+     return password;
+  }
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/CallbackHandlerPolicyContextHandler.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/CallbackHandlerPolicyContextHandler.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/CallbackHandlerPolicyContextHandler.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,73 +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.callback;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.jacc.PolicyContextException;
-import javax.security.jacc.PolicyContextHandler;
-
-/**
- A PolicyContextHandler implementation that allows a dynamic CallbackHandler to
- be associated with the current context for use with authentication.
-
- @author Scott.Stark at jboss.org
- @version $Revision$
- */
-public class CallbackHandlerPolicyContextHandler implements PolicyContextHandler
-{
-   public static final String CALLBACK_HANDLER_KEY = "org.jboss.security.auth.spi.CallbackHandler";
-   private static ThreadLocal requestContext = new ThreadLocal();
-
-   public static void setCallbackHandler(CallbackHandler bean)
-   {
-      requestContext.set(bean);
-   }
-
-   /** Access the CallbackHandler policy context data.
-    * @param key - "org.jboss.security.auth.spi.CallbackHandler"
-    * @param data currently unused
-    * @return The active CallbackHandler
-    * @throws javax.security.jacc.PolicyContextException
-    */
-   public Object getContext(String key, Object data)
-      throws PolicyContextException
-   {
-      Object context = null;
-      if( key.equalsIgnoreCase(CALLBACK_HANDLER_KEY) == true )
-         context = requestContext.get();
-      return context;
-   }
-
-   public String[] getKeys()
-      throws PolicyContextException
-   {
-      String[] keys = {CALLBACK_HANDLER_KEY};
-      return keys;
-   }
-
-   public boolean supports(String key)
-      throws PolicyContextException
-   {
-      return key.equalsIgnoreCase(CALLBACK_HANDLER_KEY);
-   }
-
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/CallbackHandlerPolicyContextHandler.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/CallbackHandlerPolicyContextHandler.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/CallbackHandlerPolicyContextHandler.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/CallbackHandlerPolicyContextHandler.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,73 @@
+/*
+* 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.callback;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.jacc.PolicyContextException;
+import javax.security.jacc.PolicyContextHandler;
+
+/**
+ A PolicyContextHandler implementation that allows a dynamic CallbackHandler to
+ be associated with the current context for use with authentication.
+
+ @author Scott.Stark at jboss.org
+ @version $Revision$
+ */
+public class CallbackHandlerPolicyContextHandler implements PolicyContextHandler
+{
+   public static final String CALLBACK_HANDLER_KEY = "org.jboss.security.auth.spi.CallbackHandler";
+   private static ThreadLocal<CallbackHandler> requestContext = new ThreadLocal<CallbackHandler>();
+
+   public static void setCallbackHandler(CallbackHandler bean)
+   {
+      requestContext.set(bean);
+   }
+
+   /** Access the CallbackHandler policy context data.
+    * @param key - "org.jboss.security.auth.spi.CallbackHandler"
+    * @param data currently unused
+    * @return The active CallbackHandler
+    * @throws javax.security.jacc.PolicyContextException
+    */
+   public Object getContext(String key, Object data)
+      throws PolicyContextException
+   {
+      Object context = null;
+      if( key.equalsIgnoreCase(CALLBACK_HANDLER_KEY) == true )
+         context = requestContext.get();
+      return context;
+   }
+
+   public String[] getKeys()
+      throws PolicyContextException
+   {
+      String[] keys = {CALLBACK_HANDLER_KEY};
+      return keys;
+   }
+
+   public boolean supports(String key)
+      throws PolicyContextException
+   {
+      return key.equalsIgnoreCase(CALLBACK_HANDLER_KEY);
+   }
+
+}

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/MapCallback.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/MapCallback.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/MapCallback.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,47 +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.callback;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.security.auth.callback.Callback;
-
-/** An implementation of Callback that simply allows for a map of information
- to be exchanged.
-
- @author  Scott.Stark at jboss.org
- @version $Revision$
-*/
-public class MapCallback implements Callback
-{
-   private Map info = new HashMap();
-
-   public Object getInfo(String key)
-   {
-      return info.get(key);
-   }
-   public void setInfo(String key, Object value)
-   {
-      info.put(key, value);
-   }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/MapCallback.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/MapCallback.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/MapCallback.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/MapCallback.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,47 @@
+/*
+* 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.callback;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.auth.callback.Callback;
+
+/** An implementation of Callback that simply allows for a map of information
+ to be exchanged.
+
+ @author  Scott.Stark at jboss.org
+ @version $Revision$
+*/
+public class MapCallback implements Callback
+{
+   private Map<String,Object> info = new HashMap<String,Object>();
+
+   public Object getInfo(String key)
+   {
+      return info.get(key);
+   }
+   public void setInfo(String key, Object value)
+   {
+      info.put(key, value);
+   }
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityActions.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/SecurityActions.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityActions.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,98 +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.callback;
-
-import java.lang.reflect.UndeclaredThrowableException;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.jacc.PolicyContext;
-import javax.security.jacc.PolicyContextException;
-
-/**
- Security actions for the callback package
-
- @author Scott.Stark at jboss.org
- @version $Revision$
- */
-public class SecurityActions
-{
-   interface PolicyContextActions
-   {
-      /** The JACC PolicyContext key for the current Subject */
-      public static final String CALLBACK_HANDLER_KEY = "org.jboss.security.auth.spi.CallbackHandler";
-      PolicyContextActions PRIVILEGED = new PolicyContextActions()
-      {
-         private final PrivilegedExceptionAction exAction = new PrivilegedExceptionAction()
-         {
-            public Object run() throws Exception
-            {
-               return (CallbackHandler) PolicyContext.getContext(CALLBACK_HANDLER_KEY);
-            }
-         };
-         public CallbackHandler getContextCallbackHandler()
-            throws PolicyContextException
-         {
-            try
-            {
-               return (CallbackHandler) AccessController.doPrivileged(exAction);
-            }
-            catch(PrivilegedActionException e)
-            {
-               Exception ex = e.getException();
-               if( ex instanceof PolicyContextException )
-                  throw (PolicyContextException) ex;
-               else
-                  throw new UndeclaredThrowableException(ex);
-            }
-         }
-      };
-
-      PolicyContextActions NON_PRIVILEGED = new PolicyContextActions()
-      {
-         public CallbackHandler getContextCallbackHandler()
-            throws PolicyContextException
-         {
-            return (CallbackHandler) PolicyContext.getContext(CALLBACK_HANDLER_KEY);
-         }
-      };
-
-      CallbackHandler getContextCallbackHandler()
-         throws PolicyContextException;
-   }
-
-   static CallbackHandler getContextCallbackHandler()
-      throws PolicyContextException
-   {
-      if(System.getSecurityManager() == null)
-      {
-         return PolicyContextActions.NON_PRIVILEGED.getContextCallbackHandler();
-      }
-      else
-      {
-         return PolicyContextActions.PRIVILEGED.getContextCallbackHandler();
-      }
-   }
-
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityActions.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/SecurityActions.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityActions.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityActions.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -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.callback;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.jacc.PolicyContext;
+import javax.security.jacc.PolicyContextException;
+
+/**
+ Security actions for the callback package
+
+ @author Scott.Stark at jboss.org
+ @version $Revision$
+ */
+public class SecurityActions
+{
+   interface PolicyContextActions
+   {
+      /** The JACC PolicyContext key for the current Subject */
+      public static final String CALLBACK_HANDLER_KEY = "org.jboss.security.auth.spi.CallbackHandler";
+      PolicyContextActions PRIVILEGED = new PolicyContextActions()
+      {
+         private final PrivilegedExceptionAction<CallbackHandler> exAction = new PrivilegedExceptionAction<CallbackHandler>()
+         {
+            public CallbackHandler run() throws Exception
+            {
+               return (CallbackHandler) PolicyContext.getContext(CALLBACK_HANDLER_KEY);
+            }
+         };
+         public CallbackHandler getContextCallbackHandler()
+            throws PolicyContextException
+         {
+            try
+            {
+               return (CallbackHandler) AccessController.doPrivileged(exAction);
+            }
+            catch(PrivilegedActionException e)
+            {
+               Exception ex = e.getException();
+               if( ex instanceof PolicyContextException )
+                  throw (PolicyContextException) ex;
+               else
+                  throw new UndeclaredThrowableException(ex);
+            }
+         }
+      };
+
+      PolicyContextActions NON_PRIVILEGED = new PolicyContextActions()
+      {
+         public CallbackHandler getContextCallbackHandler()
+            throws PolicyContextException
+         {
+            return (CallbackHandler) PolicyContext.getContext(CALLBACK_HANDLER_KEY);
+         }
+      };
+
+      CallbackHandler getContextCallbackHandler()
+         throws PolicyContextException;
+   }
+
+   static CallbackHandler getContextCallbackHandler()
+      throws PolicyContextException
+   {
+      if(System.getSecurityManager() == null)
+      {
+         return PolicyContextActions.NON_PRIVILEGED.getContextCallbackHandler();
+      }
+      else
+      {
+         return PolicyContextActions.PRIVILEGED.getContextCallbackHandler();
+      }
+   }
+
+}

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityAssociationHandler.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/SecurityAssociationHandler.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityAssociationHandler.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,177 +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.callback;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.security.Principal;
-
-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.jacc.PolicyContextException;
-
-/** An implementation of CallbackHandler is assigned a Principal, and
- opaque Object credential as values passed to the constructor. This is suitable
- for environments that need non-interactive JAAS logins and is used by the
- JaasSecurityManager as its default CallbackHandler.
-
- @see javax.security.auth.callback.CallbackHandler
- @see #handle(Callback[])
-
- @author  Scott.Stark at jboss.org
- @version $Revision$
- */
-public class SecurityAssociationHandler implements CallbackHandler, Serializable
-{  
-   private static final long serialVersionUID = 1L;
-   private transient Principal principal;
-   private transient Object credential;
-
-   public SecurityAssociationHandler()
-   {
-   }
-
-   /** Initialize the UsernamePasswordHandler with the principal
-    and credentials to use.
-    */
-   public SecurityAssociationHandler(Principal principal, Object credential)
-   {
-      this.principal = principal;
-      this.credential = credential;
-   }
-
-   public void setSecurityInfo(Principal principal, Object credential)
-   {
-      this.principal = principal;
-      this.credential = credential;
-   }
-
-   /** Handles SecurityAssociationCallback, ObjectCallback, NameCallback and
-    PasswordCallback types. A NameCallback name property is set to
-    the Prinicpal.getName() value. A PasswordCallback password property is
-    set to the getPassword() value. The preferred SecurityAssociationCallback
-    has its principal and credential properties set to the instance principal
-    and credential. An ObjectCallback has its credential set to the credential
-    value.
-
-    @see #getPassword()
-    @exception UnsupportedCallbackException - thrown if any callback of
-    type other than SecurityAssociationCallback, ObjectCallback, NameCallback
-    or PasswordCallback are seen.
-    */
-   public void handle(Callback[] callbacks) throws
-      UnsupportedCallbackException, IOException
-   {
-      for (int i = 0; i < callbacks.length; i++)
-      {
-         Callback c = callbacks[i];
-         if (c instanceof SecurityAssociationCallback)
-         {
-            SecurityAssociationCallback sac = (SecurityAssociationCallback) c;
-            sac.setPrincipal(principal);
-            sac.setCredential(credential);
-         }
-         else if (c instanceof ObjectCallback)
-         {
-            ObjectCallback oc = (ObjectCallback) c;
-            oc.setCredential(credential);
-         }
-         else if (c instanceof NameCallback)
-         {
-            NameCallback nc = (NameCallback) c;
-            if (principal != null)
-               nc.setName(principal.getName());
-         }
-         else if (c instanceof PasswordCallback)
-         {
-            PasswordCallback pc = (PasswordCallback) c;
-            char[] password = getPassword();
-            if (password != null)
-               pc.setPassword(password);
-         }
-         else
-         {
-            // Try the JACC context CallbackHandler 
-            try
-            {
-               CallbackHandler handler = SecurityActions.getContextCallbackHandler();
-               if( handler != null )
-               {
-                  Callback[] unknown = {c};
-                  handler.handle(unknown);
-                  return;
-               }
-            }
-            catch (PolicyContextException e)
-            {
-            }
-            throw new UnsupportedCallbackException(c, "Unrecognized Callback");
-         }
-      }
-   }
-
-   /** Try to convert the credential value into a char[] using the
-    first of the following attempts which succeeds:
-
-    1. Check for instanceof char[]
-    2. Check for instanceof String and then use toCharArray()
-    3. See if credential has a toCharArray() method and use it
-    4. Use toString() followed by toCharArray().
-    @return a char[] representation of the credential.
-    */
-   private char[] getPassword()
-   {
-      char[] password = null;
-      if (credential instanceof char[])
-      {
-         password = (char[]) credential;
-      }
-      else if (credential instanceof String)
-      {
-         String s = (String) credential;
-         password = s.toCharArray();
-      }
-      else
-      {
-         try
-         {
-            Class[] types = {};
-            Method m = credential.getClass().getMethod("toCharArray", types);
-            Object[] args = {};
-            password = (char[]) m.invoke(credential, args);
-         }
-         catch (Exception e)
-         {
-            if (credential != null)
-            {
-               String s = credential.toString();
-               password = s.toCharArray();
-            }
-         }
-      }
-      return password;
-   }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityAssociationHandler.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/auth/callback/SecurityAssociationHandler.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityAssociationHandler.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/auth/callback/SecurityAssociationHandler.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,177 @@
+/*
+* 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.callback;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.security.Principal;
+
+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.jacc.PolicyContextException;
+
+/** An implementation of CallbackHandler is assigned a Principal, and
+ opaque Object credential as values passed to the constructor. This is suitable
+ for environments that need non-interactive JAAS logins and is used by the
+ JaasSecurityManager as its default CallbackHandler.
+
+ @see javax.security.auth.callback.CallbackHandler
+ @see #handle(Callback[])
+
+ @author  Scott.Stark at jboss.org
+ @version $Revision$
+ */
+public class SecurityAssociationHandler implements CallbackHandler, Serializable
+{  
+   private static final long serialVersionUID = 1L;
+   private transient Principal principal;
+   private transient Object credential;
+
+   public SecurityAssociationHandler()
+   {
+   }
+
+   /** Initialize the UsernamePasswordHandler with the principal
+    and credentials to use.
+    */
+   public SecurityAssociationHandler(Principal principal, Object credential)
+   {
+      this.principal = principal;
+      this.credential = credential;
+   }
+
+   public void setSecurityInfo(Principal principal, Object credential)
+   {
+      this.principal = principal;
+      this.credential = credential;
+   }
+
+   /** Handles SecurityAssociationCallback, ObjectCallback, NameCallback and
+    PasswordCallback types. A NameCallback name property is set to
+    the Prinicpal.getName() value. A PasswordCallback password property is
+    set to the getPassword() value. The preferred SecurityAssociationCallback
+    has its principal and credential properties set to the instance principal
+    and credential. An ObjectCallback has its credential set to the credential
+    value.
+
+    @see #getPassword()
+    @exception UnsupportedCallbackException - thrown if any callback of
+    type other than SecurityAssociationCallback, ObjectCallback, NameCallback
+    or PasswordCallback are seen.
+    */
+   public void handle(Callback[] callbacks) throws
+      UnsupportedCallbackException, IOException
+   {
+      for (int i = 0; i < callbacks.length; i++)
+      {
+         Callback c = callbacks[i];
+         if (c instanceof SecurityAssociationCallback)
+         {
+            SecurityAssociationCallback sac = (SecurityAssociationCallback) c;
+            sac.setPrincipal(principal);
+            sac.setCredential(credential);
+         }
+         else if (c instanceof ObjectCallback)
+         {
+            ObjectCallback oc = (ObjectCallback) c;
+            oc.setCredential(credential);
+         }
+         else if (c instanceof NameCallback)
+         {
+            NameCallback nc = (NameCallback) c;
+            if (principal != null)
+               nc.setName(principal.getName());
+         }
+         else if (c instanceof PasswordCallback)
+         {
+            PasswordCallback pc = (PasswordCallback) c;
+            char[] password = getPassword();
+            if (password != null)
+               pc.setPassword(password);
+         }
+         else
+         {
+            // Try the JACC context CallbackHandler 
+            try
+            {
+               CallbackHandler handler = SecurityActions.getContextCallbackHandler();
+               if( handler != null )
+               {
+                  Callback[] unknown = {c};
+                  handler.handle(unknown);
+                  return;
+               }
+            }
+            catch (PolicyContextException e)
+            {
+            }
+            throw new UnsupportedCallbackException(c, "Unrecognized Callback");
+         }
+      }
+   }
+
+   /** Try to convert the credential value into a char[] using the
+    first of the following attempts which succeeds:
+
+    1. Check for instanceof char[]
+    2. Check for instanceof String and then use toCharArray()
+    3. See if credential has a toCharArray() method and use it
+    4. Use toString() followed by toCharArray().
+    @return a char[] representation of the credential.
+    */
+   private char[] getPassword()
+   {
+      char[] password = null;
+      if (credential instanceof char[])
+      {
+         password = (char[]) credential;
+      }
+      else if (credential instanceof String)
+      {
+         String s = (String) credential;
+         password = s.toCharArray();
+      }
+      else
+      {
+         try
+         {
+            Class<?>[] types = {};
+            Method m = credential.getClass().getMethod("toCharArray", types);
+            Object[] args = {};
+            password = (char[]) m.invoke(credential, args);
+         }
+         catch (Exception e)
+         {
+            if (credential != null)
+            {
+               String s = credential.toString();
+               password = s.toCharArray();
+            }
+         }
+      }
+      return password;
+   }
+}

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,117 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source.
-  * Copyright 2006, 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.mapping.providers;
- 
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.SecurityConstants;
-import org.jboss.security.SimpleGroup;
-import org.jboss.security.SimplePrincipal;
-import org.jboss.security.mapping.MappingProvider;
-import org.jboss.security.mapping.MappingResult;
-
-//$Id$
-
-/**
- *  A Role Mapping Module that takes into consideration a principal
- *  to roles mapping that can be done in the assembly descriptor of
- *  jboss.xml, jboss-web.xml and jboss-app.xml
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @since  Nov 1, 2006 
- *  @version $Revision$
- */
-public class DeploymentRolesMappingProvider implements MappingProvider<Group>
-{
-   private static Logger log = Logger.getLogger(DeploymentRolesMappingProvider.class);
-   private boolean trace = log.isTraceEnabled();
-   
-   private MappingResult<Group> result;
-
-   public void init(Map options)
-   { 
-   } 
-
-   public void setMappingResult(MappingResult res)
-   { 
-      result = res;
-   }
-
-   /**
-    * Obtains the deployment roles via the context map and applies it
-    * on the mappedObject
-    * @see MappingProvider#performMapping(Map, Object)
-    */ 
-   public void performMapping(Map map, Group mappedObject)
-   {  
-      if(map == null || map.isEmpty())
-         throw new IllegalArgumentException("Context Map is null or empty");
-    
-      //Obtain the principal to roles mapping
-      Principal principal = (Principal) map.get(SecurityConstants.PRINCIPAL_IDENTIFIER);
-      Map<String,Set<String>> principalRolesMap = (Map<String,Set<String>>)map.get(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP);
-      if(trace)
-         log.trace("Principal="+principal+":principalRolesMap="+principalRolesMap);
-      
-      if(principal == null || principalRolesMap == null || principalRolesMap.isEmpty())
-         return ; // No Mapping
-      
-      Set<String> roleset = (Set<String>)principalRolesMap.get(principal.getName());
-      if(roleset != null)
-      {
-         Group newRoles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
-         Iterator iter = roleset.iterator();
-         while(iter.hasNext())
-         {
-            String rolename = (String)iter.next();
-            newRoles.addMember(createNewPrincipal(mappedObject,rolename));
-         }
-         mappedObject = MappingProviderUtil.replacePrincipals(mappedObject, newRoles);  
-      } 
-      result.setMappedObject(mappedObject);
-   } 
-   
-   /**
-    * Need to maintain the Principal type from the original group
-    * @param mappedObject
-    * @param name
-    * @return
-    */
-   private Principal createNewPrincipal(Group mappedObject, String name)
-   {
-      Principal p = new SimplePrincipal(name);
-      
-      //If the original group had a different principal than simpleprincipal
-      if(mappedObject.members().hasMoreElements())
-      {
-         Principal origp = mappedObject.members().nextElement();
-         p = MappingProviderUtil.instantiatePrincipal(origp.getClass(), name);
-         if(p == null) 
-            p = new SimplePrincipal(name); 
-      }
-      return p;
-   } 
-}
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java (from rev 68964, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/DeploymentRolesMappingProvider.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,156 @@
+/*
+  * JBoss, Home of Professional Open Source.
+  * Copyright 2006, 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.mapping.providers;
+ 
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SimpleGroup;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.mapping.MappingProvider;
+import org.jboss.security.mapping.MappingResult;
+
+//$Id$
+
+/**
+ *  A Role Mapping Module that takes into consideration a principal
+ *  to roles mapping that can be done in the assembly descriptor of
+ *  jboss.xml, jboss-web.xml and jboss-app.xml
+ *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ *  @since  Nov 1, 2006 
+ *  @version $Revision$
+ */
+public class DeploymentRolesMappingProvider implements MappingProvider<Group>
+{
+   private static Logger log = Logger.getLogger(DeploymentRolesMappingProvider.class);
+   private boolean trace = log.isTraceEnabled();
+   
+   private MappingResult<Group> result;
+
+   public void init(Map<String,Object> options)
+   { 
+   } 
+
+   public void setMappingResult(MappingResult<Group> res)
+   { 
+      result = res;
+   }
+
+   /**
+    * Obtains the deployment roles via the context map and applies it
+    * on the mappedObject
+    * @see MappingProvider#performMapping(Map, Object)
+    */ 
+   @SuppressWarnings("unchecked")
+   public void performMapping(Map<String,Object> map, Group mappedObject)
+   {  
+      if(map == null || map.isEmpty())
+         throw new IllegalArgumentException("Context Map is null or empty");
+    
+      //Obtain the principal to roles mapping
+      Principal principal = (Principal) map.get(SecurityConstants.PRINCIPAL_IDENTIFIER);
+      Map<String,Set<String>> principalRolesMap = (Map<String,Set<String>>)map.get(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP);
+      if(trace)
+         log.trace("Principal="+principal+":principalRolesMap="+principalRolesMap);
+      
+      Set<Principal> subjectPrincipals = (Set<Principal>) map.get(SecurityConstants.PRINCIPALS_SET_IDENTIFIER);
+      
+      if(principalRolesMap == null || principalRolesMap.isEmpty())
+      {
+         result.setMappedObject(mappedObject);
+         return ; // No Mapping
+      }
+      
+      if(principal != null)
+      {
+         mappedObject = mapGroup(principal, principalRolesMap, mappedObject);
+      }
+      
+      if(subjectPrincipals != null)
+      {
+         for(Principal p: subjectPrincipals)
+         {
+            if(p instanceof Group)
+               continue;
+            mappedObject = mapGroup(p, principalRolesMap, mappedObject);
+         } 
+      }
+         
+      /*Set<String> roleset = (Set<String>)principalRolesMap.get(principal.getName());
+      if(roleset != null)
+      {
+         Group newRoles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
+         Iterator<String> iter = roleset.iterator();
+         while(iter.hasNext())
+         {
+            String rolename = iter.next();
+            newRoles.addMember(createNewPrincipal(mappedObject,rolename));
+         }
+         mappedObject = MappingProviderUtil.replacePrincipals(mappedObject, newRoles);  
+      }*/ 
+      result.setMappedObject(mappedObject);
+   } 
+   
+   private Group mapGroup(Principal principal, Map<String, Set<String>> principalRolesMap,
+         Group mappedObject)
+   {
+      Set<String> roleset = (Set<String>)principalRolesMap.get(principal.getName());
+      if(roleset != null)
+      {
+         Group newRoles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
+         Iterator<String> iter = roleset.iterator();
+         while(iter.hasNext())
+         {
+            String rolename = iter.next();
+            newRoles.addMember(createNewPrincipal(mappedObject,rolename));
+         }
+         mappedObject = MappingProviderUtil.replacePrincipals(mappedObject, newRoles);  
+      } 
+      return mappedObject;
+   }
+   
+   /**
+    * Need to maintain the Principal type from the original group
+    * @param mappedObject
+    * @param name
+    * @return
+    */
+   private Principal createNewPrincipal(Group mappedObject, String name)
+   {
+      Principal p = new SimplePrincipal(name);
+      
+      //If the original group had a different principal than simpleprincipal
+      if(mappedObject.members().hasMoreElements())
+      {
+         Principal origp = mappedObject.members().nextElement();
+         p = MappingProviderUtil.instantiatePrincipal(origp.getClass(), name);
+         if(p == null) 
+            p = new SimplePrincipal(name); 
+      }
+      return p;
+   } 
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/MappingProviderUtil.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/MappingProviderUtil.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/MappingProviderUtil.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,175 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source.
-  * Copyright 2006, 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.mapping.providers;
-
-import java.lang.reflect.Constructor;
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.StringTokenizer;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.SimplePrincipal;
-
-//$Id$
-
-/**
- *  Utility class for Mapping Providers
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @since  Oct 10, 2006 
- *  @version $Revision$
- */
-public class MappingProviderUtil
-{
-   public static Logger log = Logger.getLogger(MappingProviderUtil.class);
-   
-   /**
-    * Add principals passed via an enumeration into a group
-    * @param grp
-    * @param en
-    * @return
-    */
-   public static Group addPrincipals(Group grp, Enumeration<? extends Principal> en)
-   {
-      while(en.hasMoreElements())
-         grp.addMember(en.nextElement()); 
-      return grp;
-   }
-   
-   /**
-    * Add the roles into the Group
-    * @param roles Group of roles
-    * @param addRoles
-    * @return Group with the added roles
-    */
-   public static Group addRoles(Group roles, String[] addRoles)
-   {  
-      Class pClass = getPrincipalClass(roles); 
-      for(String str:addRoles)
-      { 
-         roles.addMember(instantiatePrincipal(pClass,str));
-      }
-      return roles;
-   }
-   
-   
-   /**
-    * Given a comma-separated list of roles, return a string array
-    * @param str
-    * @return
-    */
-   public static String[] getRolesFromCommaSeparatedString(String str)
-   {
-      if(str == null)
-         throw new IllegalArgumentException("str is null");
-      StringTokenizer st = new StringTokenizer(str,",");
-      int numTokens = st != null ? st.countTokens() : 0;
-      String[] tokens = new String[numTokens];
-      for(int i = 0; i < numTokens; i++)
-      {
-         tokens[i] = st.nextToken();
-      }
-      return tokens;
-   } 
-
-   /**
-    * Instantiate a Principal representing a principal
-    * @param cls principal class
-    * @param role Name of the role
-    * @return
-    */
-   public static Principal instantiatePrincipal(Class cls, String role)
-   {
-      Principal p = null;
-      try
-      {
-         Constructor ctr = cls.getConstructor(new Class[] {String.class});
-         p = (Principal)ctr.newInstance(new Object[]{role});
-      }
-      catch (Exception e)
-      {
-         if(log.isTraceEnabled())
-            log.trace("Encountered exception in mapping provider:instantiatePrincipal:",e);
-      } 
-      return p;
-   }
-   
-   /**
-    * Remove all the principals from the group
-    * @param grp
-    * @return
-    */
-   public static Group removePrincipals(Group grp)
-   {
-      HashSet<Principal> removeset = new HashSet<Principal>();
-      Enumeration<? extends Principal> en = grp.members();
-      while(en.hasMoreElements())
-      {
-         removeset.add(en.nextElement());
-      }
-      
-      for(Principal p:removeset)
-         grp.removeMember(p);
-      return grp;
-   }
-   
-   /**
-    * Remove the roles from the Group
-    * @param roles Group of roles
-    * @param removeRoles
-    * @return Group with roles removed
-    */
-   public static Group removeRoles(Group roles, String[] removeRoles)
-   {  
-      //Assume that the roles all belong to the same principal class
-      Class pClass = getPrincipalClass(roles); 
-      for(String str:removeRoles)
-      { 
-         roles.removeMember(instantiatePrincipal(pClass,str));
-      }
-      return roles;
-   } 
-   
-   /**
-    * Replace the principals in first group with those in the second
-    * @param fg
-    * @param sg
-    * @return
-    */
-   public static Group replacePrincipals(Group fg, Group sg)
-   { 
-      return addPrincipals( removePrincipals(fg),sg.members());
-   }
-   
-   private static Class getPrincipalClass(Group roles)
-   {
-      //Assume that the roles all belong to the same principal class 
-      Class principalClass = SimplePrincipal.class;
-      Enumeration<? extends Principal> en = roles.members();
-      if(en.hasMoreElements())
-      {
-         principalClass = roles.members().nextElement().getClass(); 
-      }
-      return principalClass;
-   }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/MappingProviderUtil.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/MappingProviderUtil.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/MappingProviderUtil.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/MappingProviderUtil.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,175 @@
+/*
+  * JBoss, Home of Professional Open Source.
+  * Copyright 2006, 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.mapping.providers;
+
+import java.lang.reflect.Constructor;
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.StringTokenizer;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.SimplePrincipal;
+
+//$Id$
+
+/**
+ *  Utility class for Mapping Providers
+ *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ *  @since  Oct 10, 2006 
+ *  @version $Revision$
+ */
+public class MappingProviderUtil
+{
+   public static Logger log = Logger.getLogger(MappingProviderUtil.class);
+   
+   /**
+    * Add principals passed via an enumeration into a group
+    * @param grp
+    * @param en
+    * @return
+    */
+   public static Group addPrincipals(Group grp, Enumeration<? extends Principal> en)
+   {
+      while(en.hasMoreElements())
+         grp.addMember(en.nextElement()); 
+      return grp;
+   }
+   
+   /**
+    * Add the roles into the Group
+    * @param roles Group of roles
+    * @param addRoles
+    * @return Group with the added roles
+    */
+   public static Group addRoles(Group roles, String[] addRoles)
+   {  
+      Class<?> pClass = getPrincipalClass(roles); 
+      for(String str:addRoles)
+      { 
+         roles.addMember(instantiatePrincipal(pClass,str));
+      }
+      return roles;
+   }
+   
+   
+   /**
+    * Given a comma-separated list of roles, return a string array
+    * @param str
+    * @return
+    */
+   public static String[] getRolesFromCommaSeparatedString(String str)
+   {
+      if(str == null)
+         throw new IllegalArgumentException("str is null");
+      StringTokenizer st = new StringTokenizer(str,",");
+      int numTokens = st != null ? st.countTokens() : 0;
+      String[] tokens = new String[numTokens];
+      for(int i = 0; i < numTokens; i++)
+      {
+         tokens[i] = st.nextToken();
+      }
+      return tokens;
+   } 
+
+   /**
+    * Instantiate a Principal representing a principal
+    * @param cls principal class
+    * @param role Name of the role
+    * @return
+    */
+   public static Principal instantiatePrincipal(Class<?> cls, String role)
+   {
+      Principal p = null;
+      try
+      {
+         Constructor<?> ctr = cls.getConstructor(new Class[] {String.class});
+         p = (Principal)ctr.newInstance(new Object[]{role});
+      }
+      catch (Exception e)
+      {
+         if(log.isTraceEnabled())
+            log.trace("Encountered exception in mapping provider:instantiatePrincipal:",e);
+      } 
+      return p;
+   }
+   
+   /**
+    * Remove all the principals from the group
+    * @param grp
+    * @return
+    */
+   public static Group removePrincipals(Group grp)
+   {
+      HashSet<Principal> removeset = new HashSet<Principal>();
+      Enumeration<? extends Principal> en = grp.members();
+      while(en.hasMoreElements())
+      {
+         removeset.add(en.nextElement());
+      }
+      
+      for(Principal p:removeset)
+         grp.removeMember(p);
+      return grp;
+   }
+   
+   /**
+    * Remove the roles from the Group
+    * @param roles Group of roles
+    * @param removeRoles
+    * @return Group with roles removed
+    */
+   public static Group removeRoles(Group roles, String[] removeRoles)
+   {  
+      //Assume that the roles all belong to the same principal class
+      Class<?> pClass = getPrincipalClass(roles); 
+      for(String str:removeRoles)
+      { 
+         roles.removeMember(instantiatePrincipal(pClass,str));
+      }
+      return roles;
+   } 
+   
+   /**
+    * Replace the principals in first group with those in the second
+    * @param fg
+    * @param sg
+    * @return
+    */
+   public static Group replacePrincipals(Group fg, Group sg)
+   { 
+      return addPrincipals( removePrincipals(fg),sg.members());
+   }
+   
+   private static Class<?> getPrincipalClass(Group roles)
+   {
+      //Assume that the roles all belong to the same principal class 
+      Class<?> principalClass = SimplePrincipal.class;
+      Enumeration<? extends Principal> en = roles.members();
+      if(en.hasMoreElements())
+      {
+         principalClass = roles.members().nextElement().getClass(); 
+      }
+      return principalClass;
+   }
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/OptionsRoleMappingProvider.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/OptionsRoleMappingProvider.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/OptionsRoleMappingProvider.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,105 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */ 
-package org.jboss.security.mapping.providers;
-  
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.mapping.MappingProvider;
-import org.jboss.security.mapping.MappingResult;
-
-
-/**
- *  Role Mapping Provider that picks up the roles from the
- *  options and then appends them to the passed Group
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @version $Revision$
- *  @since  Aug 24, 2006
- */
-public class OptionsRoleMappingProvider implements MappingProvider<Group> 
-{
-   private static final Logger log = Logger.getLogger(OptionsRoleMappingProvider.class);
-   
-   //Standard Strings
-   private static final String REPLACE_ROLES_STRING = "replaceRoles";
-   private static final String ROLES_MAP = "rolesMap";
-   
-   private MappingResult<Group> result;
-
-   private Map options = null;
-   
-   private Properties roleMapProperties = null;
-   
-   /**
-    * Specifies
-    */
-   private boolean REPLACE_ROLES = false;
-   
-   public void init(Map opt)
-   {
-     this.options = opt;
-     if(options != null)
-     {
-        if(options.containsKey(REPLACE_ROLES_STRING))
-        {
-           REPLACE_ROLES = "true".equalsIgnoreCase((String)options.get(REPLACE_ROLES_STRING)); 
-        }
-        if(options.containsKey(ROLES_MAP))
-        {
-           roleMapProperties = (Properties)options.get(ROLES_MAP);
-        } 
-     } 
-   }
-   
-   public void setMappingResult(MappingResult res)
-   { 
-      result = res;
-   }
-   
-   public void performMapping(Map contextMap, Group mappedObject)
-   { 
-      ArrayList<Principal> removeMembers = new ArrayList<Principal>();
-      ArrayList<Principal> addMembers = new ArrayList<Principal>(); 
-
-      //Enumerate over the members
-      Enumeration enumer = mappedObject.members();
-      while(enumer.hasMoreElements())
-      {
-         Principal p = (Principal)enumer.nextElement();
-         String name = p.getName(); 
-         String commaSeparatedRoles = roleMapProperties.getProperty(name);
-         if(commaSeparatedRoles != null)
-         {
-            String[] tokens = MappingProviderUtil.getRolesFromCommaSeparatedString(commaSeparatedRoles);
-            int len = tokens != null ? tokens.length : 0;
-            for(int i = 0; i < len; i++)
-            {
-               if(this.REPLACE_ROLES)
-                  removeMembers.add(p); 
-               addMembers.add(MappingProviderUtil.instantiatePrincipal(p.getClass(),tokens[i])); 
-            }
-         } 
-      }
-      //Go through  the remove list
-      for(Principal p:removeMembers)
-      {
-         mappedObject.removeMember(p);
-      }
-      //Go through the add list
-      for(Principal p:addMembers)
-      {
-         mappedObject.addMember(p);
-      }
-      
-      result.setMappedObject(mappedObject);
-   }   
-}
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/OptionsRoleMappingProvider.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/OptionsRoleMappingProvider.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/OptionsRoleMappingProvider.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/OptionsRoleMappingProvider.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */ 
+package org.jboss.security.mapping.providers;
+  
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.security.mapping.MappingProvider;
+import org.jboss.security.mapping.MappingResult;
+
+
+/**
+ *  Role Mapping Provider that picks up the roles from the
+ *  options and then appends them to the passed Group
+ *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ *  @version $Revision$
+ *  @since  Aug 24, 2006
+ */
+public class OptionsRoleMappingProvider implements MappingProvider<Group> 
+{ 
+   //Standard Strings
+   private static final String REPLACE_ROLES_STRING = "replaceRoles";
+   private static final String ROLES_MAP = "rolesMap";
+   
+   private MappingResult<Group> result;
+
+   private Map<String,Object> options = null;
+   
+   private Properties roleMapProperties = null;
+   
+   /**
+    * Specifies
+    */
+   private boolean REPLACE_ROLES = false;
+   
+   public void init(Map<String,Object> opt)
+   {
+     this.options = opt;
+     if(options != null)
+     {
+        if(options.containsKey(REPLACE_ROLES_STRING))
+        {
+           REPLACE_ROLES = "true".equalsIgnoreCase((String)options.get(REPLACE_ROLES_STRING)); 
+        }
+        if(options.containsKey(ROLES_MAP))
+        {
+           roleMapProperties = (Properties)options.get(ROLES_MAP);
+        } 
+     } 
+   }
+   
+   public void setMappingResult(MappingResult<Group> res)
+   { 
+      result = res;
+   }
+   
+   public void performMapping(Map<String,Object> contextMap, Group mappedObject)
+   { 
+      ArrayList<Principal> removeMembers = new ArrayList<Principal>();
+      ArrayList<Principal> addMembers = new ArrayList<Principal>(); 
+
+      //Enumerate over the members
+      Enumeration<? extends Principal> enumer = mappedObject.members();
+      while(enumer.hasMoreElements())
+      {
+         Principal p = (Principal)enumer.nextElement();
+         String name = p.getName(); 
+         String commaSeparatedRoles = roleMapProperties.getProperty(name);
+         if(commaSeparatedRoles != null)
+         {
+            String[] tokens = MappingProviderUtil.getRolesFromCommaSeparatedString(commaSeparatedRoles);
+            int len = tokens != null ? tokens.length : 0;
+            for(int i = 0; i < len; i++)
+            {
+               if(this.REPLACE_ROLES)
+                  removeMembers.add(p); 
+               addMembers.add(MappingProviderUtil.instantiatePrincipal(p.getClass(),tokens[i])); 
+            }
+         } 
+      }
+      //Go through  the remove list
+      for(Principal p:removeMembers)
+      {
+         mappedObject.removeMember(p);
+      }
+      //Go through the add list
+      for(Principal p:addMembers)
+      {
+         mappedObject.addMember(p);
+      }
+      
+      result.setMappedObject(mappedObject);
+   }   
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PolicyContextIdRoleMappingProvider.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/PolicyContextIdRoleMappingProvider.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PolicyContextIdRoleMappingProvider.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,162 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source.
-  * Copyright 2006, 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.mapping.providers;
-
-import java.io.IOException;
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.security.jacc.PolicyContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.SecurityConstants;
-import org.jboss.security.mapping.MappingProvider;
-import org.jboss.security.mapping.MappingResult;
-
-//$Id$
-
-/**
- *  A Role Mapping Provider that provider role mapping at the policy context id
- *  level (basically at deployment unit levels- war, ear etc)
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @since  Oct 10, 2006 
- *  @version $Revision$
- */
-public class PolicyContextIdRoleMappingProvider implements MappingProvider<Group>
-{ 
-   private static Logger log = Logger.getLogger(PolicyContextIdRoleMappingProvider.class);
-   private boolean trace = log.isTraceEnabled();
-   
-   private Map options = null; 
-   private MappingResult<Group> result;
-   
-   private Properties policyContextIdToFileNameProps = new Properties();
-   
-   private static final String PROPERTIES_ID = "map"; 
-   private static final String EXTERNAL_ID = "externalProperties";
-
-   public void init(Map opt)
-   { 
-      this.options = opt;
-      if(trace)
-         log.trace("Module Options=" + opt);
-      //Check if there is inline properties
-      if(options != null)
-      {
-         //Load up the PolicyContextId to properties-file-name properties
-         policyContextIdToFileNameProps = (Properties)options.get(PROPERTIES_ID); 
-         if(policyContextIdToFileNameProps == null)
-         {
-            //Check if was a properties file specified
-            String filename = (String)options.get(EXTERNAL_ID);
-            if(filename != null)
-            try
-            {
-               policyContextIdToFileNameProps = loadProperties(filename);
-            }
-            catch (IOException e)
-            {
-               if(trace)
-                  log.trace("Loading external properties file=", e);
-            }
-         }
-      }
-   }
-
-   public void setMappingResult(MappingResult res)
-   { 
-      result = res;
-   }
-   
-   public void performMapping(Map contextMap, Group mappedObject)
-   { 
-      ArrayList <Principal> tempPrincipalList = new ArrayList<Principal>(); 
-      
-      Principal principal = null;
-      Set<Principal> principals = (Set)contextMap.get(SecurityConstants.PRINCIPALS_SET_IDENTIFIER);
-      for(Principal p:principals)
-      {
-         if(p instanceof Group == false)
-         {
-            principal = p;
-            break;
-         }
-      }  
-      
-      if(principal == null)
-         throw new IllegalStateException("Authenticated Principal not found");
-      
-      //Get the current policy context id
-      String contextId = PolicyContext.getContextID();
-      if(trace)
-         log.trace("Policy Context ID="+ contextId);
-      if(contextId != null && policyContextIdToFileNameProps != null 
-            && policyContextIdToFileNameProps.containsKey(contextId))
-      {
-        //check if the current policy context id is present in the map
-        String filename = policyContextIdToFileNameProps.getProperty(contextId);
-        try
-        {
-           Properties props = loadProperties(filename);
-           String rolesToAdd = props.getProperty(principal.getName());
-           String[] addRoles = null;
-           if(rolesToAdd != null)
-              addRoles = MappingProviderUtil.getRolesFromCommaSeparatedString(rolesToAdd); 
-           
-           //Create a temp list of principals stored in the role group
-           Enumeration<? extends Principal> groupMembers = mappedObject.members();
-           while(groupMembers.hasMoreElements())
-           {
-              tempPrincipalList.add(groupMembers.nextElement());
-           }
-           
-           //Remove all the previous roles from the Group
-           for(Principal p:tempPrincipalList)
-           {
-              mappedObject.removeMember(p);
-           }
-           
-           //Now add the new roles to the group
-           MappingProviderUtil.addRoles(mappedObject, addRoles);
-        }
-        catch (IOException e)
-        {
-           if(trace)
-              log.trace("Exception:",e);
-        }
-      }   
-      result.setMappedObject(mappedObject);
-   } 
-   
-   private Properties loadProperties(String filename) throws IOException
-   {
-      Properties props = new Properties();
-      ClassLoader tcl = SecurityActions.getContextClassLoader();
-      props.load(tcl.getResourceAsStream(filename));
-      return props;
-   }
-}
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PolicyContextIdRoleMappingProvider.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/PolicyContextIdRoleMappingProvider.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PolicyContextIdRoleMappingProvider.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PolicyContextIdRoleMappingProvider.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,163 @@
+/*
+  * JBoss, Home of Professional Open Source.
+  * Copyright 2006, 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.mapping.providers;
+
+import java.io.IOException;
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.security.jacc.PolicyContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.mapping.MappingProvider;
+import org.jboss.security.mapping.MappingResult;
+
+//$Id$
+
+/**
+ *  A Role Mapping Provider that provider role mapping at the policy context id
+ *  level (basically at deployment unit levels- war, ear etc)
+ *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ *  @since  Oct 10, 2006 
+ *  @version $Revision$
+ */
+public class PolicyContextIdRoleMappingProvider implements MappingProvider<Group>
+{ 
+   private static Logger log = Logger.getLogger(PolicyContextIdRoleMappingProvider.class);
+   private boolean trace = log.isTraceEnabled();
+   
+   private Map<String,Object> options = null; 
+   private MappingResult<Group> result;
+   
+   private Properties policyContextIdToFileNameProps = new Properties();
+   
+   private static final String PROPERTIES_ID = "map"; 
+   private static final String EXTERNAL_ID = "externalProperties";
+
+   public void init(Map<String,Object> opt)
+   { 
+      this.options = opt;
+      if(trace)
+         log.trace("Module Options=" + opt);
+      //Check if there is inline properties
+      if(options != null)
+      {
+         //Load up the PolicyContextId to properties-file-name properties
+         policyContextIdToFileNameProps = (Properties)options.get(PROPERTIES_ID); 
+         if(policyContextIdToFileNameProps == null)
+         {
+            //Check if was a properties file specified
+            String filename = (String)options.get(EXTERNAL_ID);
+            if(filename != null)
+            try
+            {
+               policyContextIdToFileNameProps = loadProperties(filename);
+            }
+            catch (IOException e)
+            {
+               if(trace)
+                  log.trace("Loading external properties file=", e);
+            }
+         }
+      }
+   }
+
+   public void setMappingResult(MappingResult<Group> res)
+   { 
+      result = res;
+   }
+   
+   @SuppressWarnings("unchecked")
+   public void performMapping(Map<String,Object> contextMap, Group mappedObject)
+   { 
+      ArrayList <Principal> tempPrincipalList = new ArrayList<Principal>(); 
+      
+      Principal principal = null;
+      Set<Principal> principals = (Set)contextMap.get(SecurityConstants.PRINCIPALS_SET_IDENTIFIER);
+      for(Principal p:principals)
+      {
+         if(p instanceof Group == false)
+         {
+            principal = p;
+            break;
+         }
+      }  
+      
+      if(principal == null)
+         throw new IllegalStateException("Authenticated Principal not found");
+      
+      //Get the current policy context id
+      String contextId = PolicyContext.getContextID();
+      if(trace)
+         log.trace("Policy Context ID="+ contextId);
+      if(contextId != null && policyContextIdToFileNameProps != null 
+            && policyContextIdToFileNameProps.containsKey(contextId))
+      {
+        //check if the current policy context id is present in the map
+        String filename = policyContextIdToFileNameProps.getProperty(contextId);
+        try
+        {
+           Properties props = loadProperties(filename);
+           String rolesToAdd = props.getProperty(principal.getName());
+           String[] addRoles = null;
+           if(rolesToAdd != null)
+              addRoles = MappingProviderUtil.getRolesFromCommaSeparatedString(rolesToAdd); 
+           
+           //Create a temp list of principals stored in the role group
+           Enumeration<? extends Principal> groupMembers = mappedObject.members();
+           while(groupMembers.hasMoreElements())
+           {
+              tempPrincipalList.add(groupMembers.nextElement());
+           }
+           
+           //Remove all the previous roles from the Group
+           for(Principal p:tempPrincipalList)
+           {
+              mappedObject.removeMember(p);
+           }
+           
+           //Now add the new roles to the group
+           MappingProviderUtil.addRoles(mappedObject, addRoles);
+        }
+        catch (IOException e)
+        {
+           if(trace)
+              log.trace("Exception:",e);
+        }
+      }   
+      result.setMappedObject(mappedObject);
+   } 
+   
+   private Properties loadProperties(String filename) throws IOException
+   {
+      Properties props = new Properties();
+      ClassLoader tcl = SecurityActions.getContextClassLoader();
+      props.load(tcl.getResourceAsStream(filename));
+      return props;
+   }
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PrincipalToRoleMappingProvider.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/PrincipalToRoleMappingProvider.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PrincipalToRoleMappingProvider.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.mapping.providers;
- 
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.jboss.logging.Logger;
-import org.jboss.security.SecurityConstants;
-import org.jboss.security.mapping.MappingProvider;
-import org.jboss.security.mapping.MappingResult;
-
-
-/**
- *  A principal to role mapping provider  
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @version $Revision$
- *  @since  Sep 27, 2006
- */
-public class PrincipalToRoleMappingProvider implements MappingProvider<Group>
-{
-   private static final Logger log = Logger.getLogger(PrincipalToRoleMappingProvider.class);
-
-   //Standard Strings 
-   private static final String PRINCIPAL_ROLES_MAP = "principalRolesMap";
-
-   private Map options = null;
-   private MappingResult<Group> result;
-
-   private Properties principalRoleMapProperties = null;
- 
-   public void init(Map opt)
-   {
-      this.options = opt;
-      if(log.isTraceEnabled())
-         log.trace("Module Options="+options);
-      if(options != null)
-      { 
-         if(options.containsKey(PRINCIPAL_ROLES_MAP))
-         {
-            principalRoleMapProperties = (Properties)options.get(PRINCIPAL_ROLES_MAP);
-         } 
-      } 
-   }
-   
-   public void setMappingResult(MappingResult res)
-   { 
-      result = res;
-   }
-
-   public void performMapping(Map contextMap, Group mappedObject)
-   { 
-      Set<Principal> principals = (Set<Principal>) contextMap.get(SecurityConstants.PRINCIPALS_SET_IDENTIFIER);
-      for(Principal p:principals)
-      {
-         String pname = p.getName().trim();
-         boolean containsP = principalRoleMapProperties.containsKey(pname);
-         log.trace("Principal:"+pname+" is contained in options map:"+containsP);
-         if(!containsP) continue; 
-         String commaSeparatedRoles = principalRoleMapProperties.getProperty(pname);
-         if(log.isTraceEnabled())
-            log.trace("Principal:"+p.getName()+":roles add="+commaSeparatedRoles);
-         String[] tokens = MappingProviderUtil.getRolesFromCommaSeparatedString(commaSeparatedRoles);
-         int len = tokens != null ? tokens.length : 0;
-         for(int i = 0; i < len; i++)
-         {
-            mappedObject.addMember(MappingProviderUtil.instantiatePrincipal(p.getClass(),tokens[i]));
-         }
-      }   
-      result.setMappedObject(mappedObject);
-   }  
-}
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PrincipalToRoleMappingProvider.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/PrincipalToRoleMappingProvider.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PrincipalToRoleMappingProvider.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/PrincipalToRoleMappingProvider.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.mapping.providers;
+ 
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.mapping.MappingProvider;
+import org.jboss.security.mapping.MappingResult;
+
+
+/**
+ *  A principal to role mapping provider  
+ *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ *  @version $Revision$
+ *  @since  Sep 27, 2006
+ */
+public class PrincipalToRoleMappingProvider implements MappingProvider<Group>
+{
+   private static final Logger log = Logger.getLogger(PrincipalToRoleMappingProvider.class);
+
+   //Standard Strings 
+   private static final String PRINCIPAL_ROLES_MAP = "principalRolesMap";
+
+   private Map<String,Object> options = null;
+   private MappingResult<Group> result;
+
+   private Properties principalRoleMapProperties = null;
+ 
+   public void init(Map<String,Object> opt)
+   {
+      this.options = opt;
+      if(log.isTraceEnabled())
+         log.trace("Module Options="+options);
+      if(options != null)
+      { 
+         if(options.containsKey(PRINCIPAL_ROLES_MAP))
+         {
+            principalRoleMapProperties = (Properties)options.get(PRINCIPAL_ROLES_MAP);
+         } 
+      } 
+   }
+   
+   public void setMappingResult(MappingResult<Group> res)
+   { 
+      result = res;
+   }
+
+   @SuppressWarnings("unchecked")
+   public void performMapping(Map<String,Object> contextMap, Group mappedObject)
+   { 
+      Set<Principal> principals = (Set<Principal>) contextMap.get(SecurityConstants.PRINCIPALS_SET_IDENTIFIER);
+      for(Principal p:principals)
+      {
+         String pname = p.getName().trim();
+         boolean containsP = principalRoleMapProperties.containsKey(pname);
+         log.trace("Principal:"+pname+" is contained in options map:"+containsP);
+         if(!containsP) continue; 
+         String commaSeparatedRoles = principalRoleMapProperties.getProperty(pname);
+         if(log.isTraceEnabled())
+            log.trace("Principal:"+p.getName()+":roles add="+commaSeparatedRoles);
+         String[] tokens = MappingProviderUtil.getRolesFromCommaSeparatedString(commaSeparatedRoles);
+         int len = tokens != null ? tokens.length : 0;
+         for(int i = 0; i < len; i++)
+         {
+            mappedObject.addMember(MappingProviderUtil.instantiatePrincipal(p.getClass(),tokens[i]));
+         }
+      }   
+      result.setMappedObject(mappedObject);
+   }  
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/SecurityActions.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/SecurityActions.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/SecurityActions.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,98 +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.mapping.providers;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.Policy;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-//$Id$
-
-/**
- *  Privileged Blocks
- *  @author Anil.Saldhana at redhat.com
- *  @since  Sep 26, 2007 
- *  @version $Revision$
- */
-class SecurityActions
-{
-   static ClassLoader getContextClassLoader()
-   {
-      return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction()
-      { 
-         public Object run()
-         { 
-            return Thread.currentThread().getContextClassLoader();
-         }
-       });  
-   }
-   
-   static URL findResource(final URLClassLoader cl, final String name)
-   {
-      return (URL) AccessController.doPrivileged(new PrivilegedAction()
-      { 
-         public Object run()
-         { 
-            return cl.findResource(name);
-         }
-       });  
-   }
-   
-   static Policy getPolicy()
-   {
-      return (Policy) AccessController.doPrivileged(new PrivilegedAction()
-      { 
-         public Object run()
-         { 
-            return Policy.getPolicy();
-         }
-       });  
-   }
-   
-   static URL getResource(final ClassLoader cl, final String name)
-   {
-      return (URL) AccessController.doPrivileged(new PrivilegedAction()
-      { 
-         public Object run()
-         { 
-            return cl.getResource(name);
-         }
-       });  
-   }
-   
-   static InputStream openStream(final URL url) throws PrivilegedActionException
-   {
-      return (InputStream) AccessController.doPrivileged(new PrivilegedExceptionAction()
-      { 
-         public Object run() throws IOException
-         { 
-            return url.openStream();
-         }
-       });
-   }
-}
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/SecurityActions.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/mapping/providers/SecurityActions.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/SecurityActions.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/mapping/providers/SecurityActions.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,98 @@
+/*
+  * 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.mapping.providers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.Policy;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+//$Id$
+
+/**
+ *  Privileged Blocks
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Sep 26, 2007 
+ *  @version $Revision$
+ */
+class SecurityActions
+{
+   static ClassLoader getContextClassLoader()
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+      { 
+         public ClassLoader run()
+         { 
+            return Thread.currentThread().getContextClassLoader();
+         }
+       });  
+   }
+   
+   static URL findResource(final URLClassLoader cl, final String name)
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<URL>()
+      { 
+         public URL run()
+         { 
+            return cl.findResource(name);
+         }
+       });  
+   }
+   
+   static Policy getPolicy()
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<Policy>()
+      { 
+         public Policy run()
+         { 
+            return Policy.getPolicy();
+         }
+       });  
+   }
+   
+   static URL getResource(final ClassLoader cl, final String name)
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<URL>()
+      { 
+         public URL run()
+         { 
+            return cl.getResource(name);
+         }
+       });  
+   }
+   
+   static InputStream openStream(final URL url) throws PrivilegedActionException
+   {
+      return AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>()
+      { 
+         public InputStream run() throws IOException
+         { 
+            return url.openStream();
+         }
+       });
+   }
+}
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/plugins/FilePassword.java
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/plugins/FilePassword.java	2008-01-15 00:38:58 UTC (rev 68959)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/plugins/FilePassword.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,149 +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.plugins.FilePassword.main;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-
-import javax.crypto.Cipher;
-import javax.crypto.SecretKey;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.PBEKeySpec;
-import javax.crypto.spec.PBEParameterSpec;
-
-import org.jboss.logging.Logger;
-
-/** Read a password in opaque form to a file for use with the FilePassword
- accessor in conjunction with the JaasSecurityDomain
- {CLASS}org.jboss.security.plugins.FilePassword:password-file
- format of the KeyStorePass attribute. The original opaque password file
- can be created by running:
-   java org.jboss.security.plugins.FilePassword salt count password password-file
- Running
-   java org.jboss.security.plugins.FilePassword
- will generate a usage message.
-
- Note that this is security by obscurity in that the password is not store
- in plaintext, but it can be recovered by simply using the code from this
- class.
-
- @see #main(String[])
-
- @author Scott.Stark at jboss.org
- @version $Revison:$
- */
-public class FilePassword
-{
-   private File passwordFile;
-
-   public FilePassword(String file)
-   {
-      passwordFile = new File(file);
-   }
-
-   public char[] toCharArray()
-      throws IOException
-   {
-      RandomAccessFile raf = new RandomAccessFile(passwordFile, "rws");
-      try
-      {
-         char[] password = decode(raf);
-         return password;
-      }
-      catch(Exception e)
-      {
-         Logger log = Logger.getLogger(FilePassword.class);
-         log.error("Failed to decode password file: "+passwordFile, e);
-         throw new IOException(e.getMessage());
-      }
-   }
-
-   static char[] decode(RandomAccessFile passwordFile)
-      throws Exception
-   {
-      byte[] salt = new byte[8];
-      passwordFile.readFully(salt);
-      int count = passwordFile.readInt();
-      ByteArrayOutputStream baos = new ByteArrayOutputStream();
-      int b;
-      while( (b = passwordFile.read()) >= 0 )
-         baos.write(b);
-      passwordFile.close();
-      byte[] secret = baos.toByteArray();
-
-      PBEParameterSpec cipherSpec = new PBEParameterSpec(salt, count);
-      PBEKeySpec keySpec = new PBEKeySpec("78aac249a60a13d5e882927928043ebb".toCharArray());
-      SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEwithMD5andDES");
-      SecretKey cipherKey = factory.generateSecret(keySpec);
-      Cipher cipher = Cipher.getInstance("PBEwithMD5andDES");
-      cipher.init(Cipher.DECRYPT_MODE, cipherKey, cipherSpec);
-      byte[] decode = cipher.doFinal(secret);
-      return new String(decode, "UTF-8").toCharArray();
-   }
-   static void encode(RandomAccessFile passwordFile, byte[] salt, int count,
-      byte[] secret)
-      throws Exception
-   {
-      PBEParameterSpec cipherSpec = new PBEParameterSpec(salt, count);
-      PBEKeySpec keySpec = new PBEKeySpec("78aac249a60a13d5e882927928043ebb".toCharArray());
-      SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEwithMD5andDES");
-      SecretKey cipherKey = factory.generateSecret(keySpec);
-      Cipher cipher = Cipher.getInstance("PBEwithMD5andDES");
-      cipher.init(Cipher.ENCRYPT_MODE, cipherKey, cipherSpec);
-      byte[] encode = cipher.doFinal(secret);
-      passwordFile.write(salt);
-      passwordFile.writeInt(count);
-      passwordFile.write(encode);
-      passwordFile.close();
-
-   }
-   /** Write a password in opaque form to a file for use with the FilePassword
-    * accessor in conjunction with the JaasSecurityDomain
-    * {CLASS}org.jboss.security.plugins.FilePassword:password-file
-    * format of the KeyStorePass attribute.
-    * 
-    * @param args
-    */ 
-   public static void main(String[] args) throws Exception
-   {
-      if( args.length != 4 )
-      {
-         System.err.println(
-            "Write a password in opaque form to a file for use with the FilePassword accessor"
-           +"Usage: FilePassword salt count password password-file"
-           +"  salt  : an 8 char sequence for PBEKeySpec"
-           +"  count : iteration count for PBEKeySpec"
-           +"  password : the clear text password to write"
-           +"  password-file : the path to the file to write the password to"
-         );
-      }
-      byte[] salt = args[0].substring(0, 8).getBytes();
-      int count = Integer.parseInt(args[1]);
-      byte[] passwordBytes = args[2].getBytes("UTF-8");
-      RandomAccessFile passwordFile = new RandomAccessFile(args[3], "rws");
-      encode(passwordFile, salt, count, passwordBytes);
-   }
-}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/plugins/FilePassword.java (from rev 68965, projects/security/security-jboss-sx/trunk/jbosssx/src/main/org/jboss/security/plugins/FilePassword.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/plugins/FilePassword.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/main/org/jboss/security/plugins/FilePassword.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,147 @@
+/*
+* 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 java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.PBEParameterSpec;
+
+import org.jboss.logging.Logger;
+
+/** Read a password in opaque form to a file for use with the FilePassword
+ accessor in conjunction with the JaasSecurityDomain
+ {CLASS}org.jboss.security.plugins.FilePassword:password-file
+ format of the KeyStorePass attribute. The original opaque password file
+ can be created by running:
+   java org.jboss.security.plugins.FilePassword salt count password password-file
+ Running
+   java org.jboss.security.plugins.FilePassword
+ will generate a usage message.
+
+ Note that this is security by obscurity in that the password is not store
+ in plaintext, but it can be recovered by simply using the code from this
+ class.
+
+ @see #main(String[])
+
+ @author Scott.Stark at jboss.org
+ @version $Revison:$
+ */
+public class FilePassword
+{
+   private File passwordFile;
+
+   public FilePassword(String file)
+   {
+      passwordFile = new File(file);
+   }
+
+   public char[] toCharArray()
+      throws IOException
+   {
+      RandomAccessFile raf = new RandomAccessFile(passwordFile, "rws");
+      try
+      {
+         char[] password = decode(raf);
+         return password;
+      }
+      catch(Exception e)
+      {
+         Logger log = Logger.getLogger(FilePassword.class);
+         log.error("Failed to decode password file: "+passwordFile, e);
+         throw new IOException(e.getMessage());
+      }
+   }
+
+   static char[] decode(RandomAccessFile passwordFile)
+      throws Exception
+   {
+      byte[] salt = new byte[8];
+      passwordFile.readFully(salt);
+      int count = passwordFile.readInt();
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+      int b;
+      while( (b = passwordFile.read()) >= 0 )
+         baos.write(b);
+      passwordFile.close();
+      byte[] secret = baos.toByteArray();
+
+      PBEParameterSpec cipherSpec = new PBEParameterSpec(salt, count);
+      PBEKeySpec keySpec = new PBEKeySpec("78aac249a60a13d5e882927928043ebb".toCharArray());
+      SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEwithMD5andDES");
+      SecretKey cipherKey = factory.generateSecret(keySpec);
+      Cipher cipher = Cipher.getInstance("PBEwithMD5andDES");
+      cipher.init(Cipher.DECRYPT_MODE, cipherKey, cipherSpec);
+      byte[] decode = cipher.doFinal(secret);
+      return new String(decode, "UTF-8").toCharArray();
+   }
+   static void encode(RandomAccessFile passwordFile, byte[] salt, int count,
+      byte[] secret)
+      throws Exception
+   {
+      PBEParameterSpec cipherSpec = new PBEParameterSpec(salt, count);
+      PBEKeySpec keySpec = new PBEKeySpec("78aac249a60a13d5e882927928043ebb".toCharArray());
+      SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEwithMD5andDES");
+      SecretKey cipherKey = factory.generateSecret(keySpec);
+      Cipher cipher = Cipher.getInstance("PBEwithMD5andDES");
+      cipher.init(Cipher.ENCRYPT_MODE, cipherKey, cipherSpec);
+      byte[] encode = cipher.doFinal(secret);
+      passwordFile.write(salt);
+      passwordFile.writeInt(count);
+      passwordFile.write(encode);
+      passwordFile.close();
+
+   }
+   /** Write a password in opaque form to a file for use with the FilePassword
+    * accessor in conjunction with the JaasSecurityDomain
+    * {CLASS}org.jboss.security.plugins.FilePassword:password-file
+    * format of the KeyStorePass attribute.
+    * 
+    * @param args
+    */ 
+   public static void main(String[] args) throws Exception
+   {
+      if( args.length != 4 )
+      {
+         System.err.println(
+            "Write a password in opaque form to a file for use with the FilePassword accessor"
+           +"Usage: FilePassword salt count password password-file"
+           +"  salt  : an 8 char sequence for PBEKeySpec"
+           +"  count : iteration count for PBEKeySpec"
+           +"  password : the clear text password to write"
+           +"  password-file : the path to the file to write the password to"
+         );
+      }
+      byte[] salt = args[0].substring(0, 8).getBytes();
+      int count = Integer.parseInt(args[1]);
+      byte[] passwordBytes = args[2].getBytes("UTF-8");
+      RandomAccessFile passwordFile = new RandomAccessFile(args[3], "rws");
+      encode(passwordFile, salt, count, passwordBytes);
+   }
+}

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/tests/org/jboss/test/security/mapping/DeploymentRolesMappingUnitTestCase.java (from rev 68964, projects/security/security-jboss-sx/trunk/jbosssx/src/tests/org/jboss/test/security/mapping/DeploymentRolesMappingUnitTestCase.java)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/tests/org/jboss/test/security/mapping/DeploymentRolesMappingUnitTestCase.java	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx/src/tests/org/jboss/test/security/mapping/DeploymentRolesMappingUnitTestCase.java	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,125 @@
+/*
+  * 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.mapping;
+
+import java.security.acl.Group;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SimpleGroup;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.mapping.MappingResult;
+import org.jboss.security.mapping.providers.DeploymentRolesMappingProvider;
+
+import junit.framework.TestCase;
+
+//$Id$
+
+/**
+ *  Unit test the DeploymentRolesMappingProvider
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Jan 14, 2008 
+ *  @version $Revision$
+ */
+public class DeploymentRolesMappingUnitTestCase extends TestCase
+{
+   public void testMappingWithPrincipal()
+   {
+      Map<String,Object> cmap = new HashMap<String,Object>();
+     
+      cmap.put(SecurityConstants.PRINCIPAL_IDENTIFIER, new SimplePrincipal("anil"));
+      cmap.put(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP, getPrincipalRoleMap());
+      
+      assertTrue(getMapping(cmap));
+   }
+   
+   public void testMappingWithPrincipalSet()
+   {  
+      Map<String,Object> cmap = new HashMap<String,Object>();
+      Subject subject = new Subject();
+      subject.getPrincipals().add(new SimplePrincipal("anil"));
+     
+      cmap.put(SecurityConstants.PRINCIPALS_SET_IDENTIFIER, subject.getPrincipals());
+      cmap.put(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP, getPrincipalRoleMap());
+       
+      assertTrue(getMapping(cmap));
+   }
+   
+   public void testUnsuccessfulMappingWithPrincipal()
+   {
+      Map<String,Object> cmap = new HashMap<String,Object>(); 
+      cmap.put(SecurityConstants.PRINCIPAL_IDENTIFIER, new SimplePrincipal("impostor"));
+      cmap.put(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP, getPrincipalRoleMap());
+      
+      assertFalse(getMapping(cmap));
+   }
+   
+   public void testUnsuccessfulMappingWithPrincipalSet()
+   {  
+      Map<String,Object> cmap = new HashMap<String,Object>();
+      Subject subject = new Subject();
+      subject.getPrincipals().add(new SimplePrincipal("impostor"));
+     
+      cmap.put(SecurityConstants.PRINCIPALS_SET_IDENTIFIER, subject.getPrincipals());
+      cmap.put(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP, getPrincipalRoleMap());
+       
+      assertFalse(getMapping(cmap));
+   }
+   
+   private boolean getMapping(Map<String,Object> cmap)
+   {
+      DeploymentRolesMappingProvider drmp = new DeploymentRolesMappingProvider();
+      MappingResult<Group> result = new MappingResult<Group>();
+      drmp.setMappingResult(result);
+      
+      drmp.performMapping(cmap, getGroup(new String[]{"gooduser","okuser"}));
+      return result.getMappedObject().isMember(new SimplePrincipal("allowedUser")); 
+   }
+   
+   private Map<String,Set<String>> getPrincipalRoleMap()
+   {
+      Map<String,Set<String>> pmap = new HashMap<String,Set<String>>();
+      
+      Set<String> roleSet = new HashSet<String>();
+      String[] rolearr = {"allowedUser"}; 
+      roleSet.addAll(Arrays.asList(rolearr));
+      pmap.put("anil", roleSet);
+      return pmap;
+   }
+   
+   private Group getGroup(String[] principalArr)
+   {
+      SimpleGroup sg = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
+      for(String p: principalArr)
+      {
+         sg.addMember(new SimplePrincipal(p));
+      }
+      return sg;
+   }
+
+}
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client (from rev 68788, projects/security/security-jboss-sx/trunk/jbosssx-client)

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client/pom.xml
===================================================================
--- projects/security/security-jboss-sx/trunk/jbosssx-client/pom.xml	2008-01-10 05:29:26 UTC (rev 68788)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -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-client</artifactId>
-   <version>2.0.2-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>
-                  <manifestFile>../jbosssx/src/etc/default.mf</manifestFile>
-               </archive>
-               <classesDirectory>../jbosssx/target/classes</classesDirectory>
-            </configuration>
-         </plugin>
-         <plugin>
-            <artifactId>maven-antrun-plugin</artifactId>
-            <version>1.1</version>
-            <inherited>true</inherited>
-            <executions>
-               <execution>
-                  <id>buildjar</id>
-                  <phase>package</phase>
-                  <configuration>
-                     <tasks>
-                        <!-- Build jbosssx-client.jar -->
-                        <jar jarfile="${basedir}/target/jbosssx-client-${version}.jar" manifest="${basedir}/../jbosssx/src/etc/default.mf" update="true">
-                           <fileset dir="${basedir}/../jbosssx/target/classes">
-                              <exclude name="META-INF/MANIFEST.MF" />
-                              <!-- HACK -->
-                              <include name="org/jboss/crypto/JBossSXProvider.class" />
-                              <include name="org/jboss/crypto/digest/*" />
-                              <include name="org/jboss/security/*" />
-                              <include name="org/jboss/security/auth/callback/*" />
-                              <include name="org/jboss/security/auth/login/*" />
-                              <include name="org/jboss/security/client/*" />
-                              <exclude name="org/jboss/security/auth/login/XMLLoginConfig.class" />
-                              <exclude name="org/jboss/security/auth/login/XMLLoginConfigMBean.class" />
-                              <include name="org/jboss/security/jndi/LoginInitialContextFactory.class" />
-                              <include name="org/jboss/security/jndi/JndiLoginInitialContextFactory.class" />
-                              <include name="org/jboss/security/plugins/PBEUtils.class" />
-                              <include name="org/jboss/security/ssl/ClientSocketFactory.class" />
-                              <include name="org/jboss/security/ssl/RMISSLClientSocketFactory.class" />
-                              <include name="org/jboss/security/plugins/*SecurityContext*.class" />
-                           </fileset>
-                           <fileset file="${basedir}/../jbosssx/JBossORG-EULA.txt" />
-                        </jar>
-                     </tasks>
-                  </configuration>
-                  <goals>
-                     <goal>run</goal>
-                  </goals>
-               </execution>
-            </executions>
-         </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>
-       </configuration>
-     </plugin>
-    </plugins>
- </build>
-
-</project>
\ No newline at end of file

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client/pom.xml (from rev 68973, projects/security/security-jboss-sx/trunk/jbosssx-client/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client/pom.xml	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/jbosssx-client/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -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-client</artifactId>
+   <version>2.0.2.Beta4</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>
+                  <manifestFile>../jbosssx/src/etc/default.mf</manifestFile>
+               </archive>
+               <classesDirectory>../jbosssx/target/classes</classesDirectory>
+            </configuration>
+         </plugin>
+         <plugin>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <version>1.1</version>
+            <inherited>true</inherited>
+            <executions>
+               <execution>
+                  <id>buildjar</id>
+                  <phase>package</phase>
+                  <configuration>
+                     <tasks>
+                        <!-- Build jbosssx-client.jar -->
+                        <jar jarfile="${basedir}/target/jbosssx-client-${version}.jar" manifest="${basedir}/../jbosssx/src/etc/default.mf" update="true">
+                           <fileset dir="${basedir}/../jbosssx/target/classes">
+                              <exclude name="META-INF/MANIFEST.MF" />
+                              <!-- HACK -->
+                              <include name="org/jboss/crypto/JBossSXProvider.class" />
+                              <include name="org/jboss/crypto/digest/*" />
+                              <include name="org/jboss/security/*" />
+                              <include name="org/jboss/security/auth/callback/*" />
+                              <include name="org/jboss/security/auth/login/*" />
+                              <include name="org/jboss/security/client/*" />
+                              <exclude name="org/jboss/security/auth/login/XMLLoginConfig.class" />
+                              <exclude name="org/jboss/security/auth/login/XMLLoginConfigMBean.class" />
+                              <include name="org/jboss/security/jndi/LoginInitialContextFactory.class" />
+                              <include name="org/jboss/security/jndi/JndiLoginInitialContextFactory.class" />
+                              <include name="org/jboss/security/plugins/PBEUtils.class" />
+                              <include name="org/jboss/security/ssl/ClientSocketFactory.class" />
+                              <include name="org/jboss/security/ssl/RMISSLClientSocketFactory.class" />
+                              <include name="org/jboss/security/plugins/*SecurityContext*.class" />
+                           </fileset>
+                           <fileset file="${basedir}/../jbosssx/JBossORG-EULA.txt" />
+                        </jar>
+                     </tasks>
+                  </configuration>
+                  <goals>
+                     <goal>run</goal>
+                  </goals>
+               </execution>
+            </executions>
+         </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>
+       </configuration>
+     </plugin>
+    </plugins>
+ </build>
+
+</project>
\ No newline at end of file

Deleted: projects/security/security-jboss-sx/tags/2.0.2.Beta4/pom.xml
===================================================================
--- projects/security/security-jboss-sx/trunk/pom.xml	2008-01-10 05:42:24 UTC (rev 68789)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -1,252 +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-parent</artifactId>
-   <version>2.0.2-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/trunk</connection>
-      <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/trunk</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>identity</module>
-     <module>jbosssx</module>
-     <module>jbosssx-client</module>
-     <module>acl</module>
-     <module>assembly</module>
-   </modules>
-  
-   <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>
-      <modules>
-        <module>jbosssx</module>
-      </modules>
-    </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>
-      <modules>
-        <module>jbosssx</module>
-      </modules>
-    </profile>
-
-    <!-- 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>
-
-   <build>
-    <plugins>
-     <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <printSummary>true</printSummary>
-          <disableXmlReport>false</disableXmlReport>
-          <testFailureIgnore>true</testFailureIgnore>
-          <includes>
-             <include>**/**TestCase.java</include>
-          </includes>
-          <forkMode>pertest</forkMode>
-          <argLine>${surefire.jvm.args}</argLine>
-          <useFile>false</useFile>
-          <trimStackTrace>false</trimStackTrace>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.jboss.maven.plugins</groupId>
-        <artifactId>maven-jboss-deploy-plugin</artifactId>
-        <version>1.6</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>
-  
-  <dependencyManagement>
-   <dependencies>
-     <dependency>
-        <groupId>org.jboss</groupId>
-        <artifactId>jboss-common-core</artifactId>
-        <version>2.2.1.GA</version>
-        <scope>compile</scope>
-     </dependency>
-     <dependency>
-        <groupId>jboss</groupId>
-        <artifactId>jboss-logging-spi</artifactId>
-        <version>2.0.2.GA</version>
-        <scope>compile</scope>
-     </dependency>
-     <dependency>
-        <groupId>jboss</groupId>
-        <artifactId>jboss-logging-log4j</artifactId>
-        <version>2.0.2.GA</version>
-        <scope>runtime</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-transaction-api</artifactId>
-         <version>1.0.1.${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>acl-spi</artifactId>
-         <version>${org.jboss.security.spi.version}</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>authorization-spi</artifactId>
-         <version>${org.jboss.security.spi.version}</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>identity-spi</artifactId>
-         <version>${org.jboss.security.spi.version}</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>jboss-security-spi-bare</artifactId>
-         <version>${org.jboss.security.spi.version}</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>apache-log4j</groupId>
-         <artifactId>log4j</artifactId>
-         <version>1.2.14</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>junit</groupId>
-         <artifactId>junit</artifactId>
-         <version>3.8.1</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
-         <groupId>org.jboss</groupId>
-         <artifactId>jboss-test</artifactId>
-        <version>1.0.4.GA</version>
-         <scope>test</scope>
-      </dependency>    
-   </dependencies>
-  </dependencyManagement>
-  
-   <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>
-  
-  <properties>
-    <org.jboss.javaee.version>Beta3Update1</org.jboss.javaee.version>
-    <org.jboss.security.spi.version>2.0.2.Beta3</org.jboss.security.spi.version>
-  </properties>
-  
-</project>

Copied: projects/security/security-jboss-sx/tags/2.0.2.Beta4/pom.xml (from rev 68973, projects/security/security-jboss-sx/trunk/pom.xml)
===================================================================
--- projects/security/security-jboss-sx/tags/2.0.2.Beta4/pom.xml	                        (rev 0)
+++ projects/security/security-jboss-sx/tags/2.0.2.Beta4/pom.xml	2008-01-15 05:53:49 UTC (rev 68974)
@@ -0,0 +1,252 @@
+<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-parent</artifactId>
+   <version>2.0.2.Beta4</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.2.Beta4</connection>
+      <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/security/security-jboss-sx/tags/2.0.2.Beta4</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>identity</module>
+     <module>jbosssx</module>
+     <module>jbosssx-client</module>
+     <module>acl</module>
+     <module>assembly</module>
+   </modules>
+  
+   <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>
+      <modules>
+        <module>jbosssx</module>
+      </modules>
+    </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>
+      <modules>
+        <module>jbosssx</module>
+      </modules>
+    </profile>
+
+    <!-- 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>
+
+   <build>
+    <plugins>
+     <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <printSummary>true</printSummary>
+          <disableXmlReport>false</disableXmlReport>
+          <testFailureIgnore>true</testFailureIgnore>
+          <includes>
+             <include>**/**TestCase.java</include>
+          </includes>
+          <forkMode>pertest</forkMode>
+          <argLine>${surefire.jvm.args}</argLine>
+          <useFile>false</useFile>
+          <trimStackTrace>false</trimStackTrace>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.jboss.maven.plugins</groupId>
+        <artifactId>maven-jboss-deploy-plugin</artifactId>
+        <version>1.6</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>
+  
+  <dependencyManagement>
+   <dependencies>
+     <dependency>
+        <groupId>org.jboss</groupId>
+        <artifactId>jboss-common-core</artifactId>
+        <version>2.2.1.GA</version>
+        <scope>compile</scope>
+     </dependency>
+     <dependency>
+        <groupId>jboss</groupId>
+        <artifactId>jboss-logging-spi</artifactId>
+        <version>2.0.2.GA</version>
+        <scope>compile</scope>
+     </dependency>
+     <dependency>
+        <groupId>jboss</groupId>
+        <artifactId>jboss-logging-log4j</artifactId>
+        <version>2.0.2.GA</version>
+        <scope>runtime</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-transaction-api</artifactId>
+         <version>1.0.1.${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>acl-spi</artifactId>
+         <version>${org.jboss.security.spi.version}</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>authorization-spi</artifactId>
+         <version>${org.jboss.security.spi.version}</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>identity-spi</artifactId>
+         <version>${org.jboss.security.spi.version}</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>jboss-security-spi-bare</artifactId>
+         <version>${org.jboss.security.spi.version}</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>apache-log4j</groupId>
+         <artifactId>log4j</artifactId>
+         <version>1.2.14</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <version>3.8.1</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss</groupId>
+         <artifactId>jboss-test</artifactId>
+        <version>1.0.4.GA</version>
+         <scope>test</scope>
+      </dependency>    
+   </dependencies>
+  </dependencyManagement>
+  
+   <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>
+  
+  <properties>
+    <org.jboss.javaee.version>Beta3Update1</org.jboss.javaee.version>
+    <org.jboss.security.spi.version>2.0.2.Beta3</org.jboss.security.spi.version>
+  </properties>
+  
+</project>




More information about the jboss-cvs-commits mailing list