[jboss-cvs] JBossAS SVN: r67068 - in branches/Branch_4_2/security/src/main/org/jboss/security: auth/login and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 14 10:04:34 EST 2007


Author: anil.saldhana at jboss.com
Date: 2007-11-14 10:04:33 -0500 (Wed, 14 Nov 2007)
New Revision: 67068

Modified:
   branches/Branch_4_2/security/src/main/org/jboss/security/SecurityConstants.java
   branches/Branch_4_2/security/src/main/org/jboss/security/auth/login/AuthenticationInfo.java
Log:
JBAS-4969:add a system property to disable sending the security domain name in the module options to the login modules, in the case when a rare login module may not like additional module options

Modified: branches/Branch_4_2/security/src/main/org/jboss/security/SecurityConstants.java
===================================================================
--- branches/Branch_4_2/security/src/main/org/jboss/security/SecurityConstants.java	2007-11-14 14:45:15 UTC (rev 67067)
+++ branches/Branch_4_2/security/src/main/org/jboss/security/SecurityConstants.java	2007-11-14 15:04:33 UTC (rev 67068)
@@ -41,4 +41,10 @@
     * name the LoginModule was configured in.
     */
    String SECURITY_DOMAIN_OPTION = "jboss.security.security_domain";
+   
+   /**
+    * System Property that disables the addition of security domain
+    * in the module options passed to login module
+    */
+   String DISABLE_SECDOMAIN_OPTION = "jboss.security.disable.secdomain.option";
 }

Modified: branches/Branch_4_2/security/src/main/org/jboss/security/auth/login/AuthenticationInfo.java
===================================================================
--- branches/Branch_4_2/security/src/main/org/jboss/security/auth/login/AuthenticationInfo.java	2007-11-14 14:45:15 UTC (rev 67067)
+++ branches/Branch_4_2/security/src/main/org/jboss/security/auth/login/AuthenticationInfo.java	2007-11-14 15:04:33 UTC (rev 67068)
@@ -21,6 +21,8 @@
  */
 package org.jboss.security.auth.login;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -72,8 +74,11 @@
       for(int i = 0; i < copy.length; i ++)
       {
          AppConfigurationEntry entry = (AppConfigurationEntry) loginModules.get(i);
-	 HashMap options = new HashMap(entry.getOptions()); 
-         options.put(SecurityConstants.SECURITY_DOMAIN_OPTION, this.getName());
+	     HashMap options = new HashMap(entry.getOptions()); 
+         if(!disableSecurityDomainInOptions())
+         {
+            options.put(SecurityConstants.SECURITY_DOMAIN_OPTION, this.getName());
+         }
          copy[i] = new AppConfigurationEntry(entry.getLoginModuleName(),
 					     entry.getControlFlag(), options);
       }
@@ -141,5 +146,16 @@
       }
       return buffer.toString();
    }
-
-}
+   
+   private boolean disableSecurityDomainInOptions()
+   {
+      String sysprop = (String)AccessController.doPrivileged(new PrivilegedAction()
+      {
+         public Object run()
+         {
+            return System.getProperty(SecurityConstants.DISABLE_SECDOMAIN_OPTION);
+         }
+      });
+      return "true".equalsIgnoreCase(sysprop); 
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list