[jboss-cvs] JBossAS SVN: r60041 - branches/Branch_4_2/test/src/main/org/jboss/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 26 20:16:27 EST 2007


Author: scott.stark at jboss.org
Date: 2007-01-26 20:16:26 -0500 (Fri, 26 Jan 2007)
New Revision: 60041

Modified:
   branches/Branch_4_2/test/src/main/org/jboss/test/JBossTestCase.java
   branches/Branch_4_2/test/src/main/org/jboss/test/JBossTestSetup.java
Log:
Add initDefaultLoginConfig method to validate the java.security.auth.login.config setting, and if not found, set it to the security/auth.conf classpath resource value if that exists.


Modified: branches/Branch_4_2/test/src/main/org/jboss/test/JBossTestCase.java
===================================================================
--- branches/Branch_4_2/test/src/main/org/jboss/test/JBossTestCase.java	2007-01-27 00:57:33 UTC (rev 60040)
+++ branches/Branch_4_2/test/src/main/org/jboss/test/JBossTestCase.java	2007-01-27 01:16:26 UTC (rev 60041)
@@ -381,6 +381,31 @@
       delegate.flushAuthCache(domain);
    }
 
+   /**
+    * Validate the java.security.auth.login.config setting, and if not
+    * found, set it to the security/auth.conf classpath resource value
+    * if that exists.
+    * @throws IllegalStateException if neither java.security.auth.login.config
+    * is set and no security/auth.conf classpath resource exists.
+    */
+   protected void initDefaultLoginConfig()
+   {
+      String authConf = System.getProperty("java.security.auth.login.config");
+      if( authConf == null )
+      {
+         try
+         {
+            String confURL = getResourceURL("security/auth.conf");
+            if( confURL == null )
+               throw new IllegalStateException("No java.security.auth.login.config specified and security/auth.conf not found");
+            System.setProperty("java.security.auth.login.config", confURL);
+         }
+         catch(Exception ignore)
+         {
+         }
+      }
+   }
+
    /** Restart the connection pool associated with the DefaultDS
     * @throws Exception on failure
     */

Modified: branches/Branch_4_2/test/src/main/org/jboss/test/JBossTestSetup.java
===================================================================
--- branches/Branch_4_2/test/src/main/org/jboss/test/JBossTestSetup.java	2007-01-27 00:57:33 UTC (rev 60040)
+++ branches/Branch_4_2/test/src/main/org/jboss/test/JBossTestSetup.java	2007-01-27 01:16:26 UTC (rev 60041)
@@ -190,7 +190,30 @@
    {
       delegate.flushAuthCache(domain);
    }
-
+   /**
+    * Validate the java.security.auth.login.config setting, and if not
+    * found, set it to the security/auth.conf classpath resource value
+    * if that exists.
+    * @throws IllegalStateException if neither java.security.auth.login.config
+    * is set and no security/auth.conf classpath resource exists.
+    */
+   protected void initDefaultLoginConfig()
+   {
+      String authConf = System.getProperty("java.security.auth.login.config");
+      if( authConf == null )
+      {
+         try
+         {
+            String confURL = getResourceURL("security/auth.conf");
+            if( confURL == null )
+               throw new IllegalStateException("No java.security.auth.login.config specified and security/auth.conf not found");
+            System.setProperty("java.security.auth.login.config", confURL);
+         }
+         catch(Exception ignore)
+         {
+         }
+      }
+   }
    /** Restart the connection pool associated with the DefaultDS
     * @throws Exception on failure
     */




More information about the jboss-cvs-commits mailing list