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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 26 18:21:01 EST 2007


Author: scott.stark at jboss.org
Date: 2007-01-26 18:21:00 -0500 (Fri, 26 Jan 2007)
New Revision: 60033

Modified:
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/jacc/test/CallerInRoleUnitTestCase.java
Log:
Validate the java.security.auth.login.config setting, and if not found, set it to the security/auth.conf classpath resource value.

Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/jacc/test/CallerInRoleUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/jacc/test/CallerInRoleUnitTestCase.java	2007-01-26 23:12:27 UTC (rev 60032)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/jacc/test/CallerInRoleUnitTestCase.java	2007-01-26 23:21:00 UTC (rev 60033)
@@ -21,6 +21,8 @@
  */
 package org.jboss.test.jacc.test;
 
+import java.net.URL;
+
 import javax.rmi.PortableRemoteObject;
 import javax.security.auth.login.Configuration;
 import javax.security.auth.login.LoginContext;
@@ -68,6 +70,17 @@
    private void login(String username, char[] password) throws Exception
    {  
       lc = null;
+      /* Validate the java.security.auth.login.config setting, and if not
+         found, set it to the security/auth.conf classpath resource value.
+      */
+      String authConf = System.getProperty("java.security.auth.login.config");
+      if( authConf == null )
+      {
+         String confURL = super.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);
+      }
       String confName = System.getProperty("conf.name", "spec-test");
       AppCallbackHandler handler = new AppCallbackHandler(username, password);
       log.debug("Creating LoginContext("+confName+")");




More information about the jboss-cvs-commits mailing list