[jboss-cvs] JBossAS SVN: r71545 - in trunk/connector: src/main/org/jboss/resource/security and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 1 06:35:36 EDT 2008
Author: adrian at jboss.org
Date: 2008-04-01 06:35:35 -0400 (Tue, 01 Apr 2008)
New Revision: 71545
Added:
trunk/connector/src/main/org/jboss/resource/security/PBEIdentityLoginModule.java
Modified:
trunk/connector/build.xml
trunk/connector/src/main/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java
trunk/connector/src/main/org/jboss/resource/security/CallerIdentityLoginModule.java
trunk/connector/src/main/org/jboss/resource/security/ConfiguredIdentityLoginModule.java
trunk/connector/src/main/org/jboss/resource/security/GetPrincipalInfoAction.java
trunk/connector/src/main/org/jboss/resource/security/JaasSecurityDomainIdentityLoginModule.java
trunk/connector/src/main/org/jboss/resource/security/SecureIdentityLoginModule.java
trunk/connector/src/main/org/jboss/resource/security/SubjectActions.java
Log:
License headers and port PBE login module from 4.2.x
Modified: trunk/connector/build.xml
===================================================================
--- trunk/connector/build.xml 2008-04-01 10:34:18 UTC (rev 71544)
+++ trunk/connector/build.xml 2008-04-01 10:35:35 UTC (rev 71545)
@@ -108,6 +108,7 @@
<path refid="jboss.jboss.jaspi.api.classpath"/>
<path refid="jboss.jbosssx.classpath"/>
<path refid="jboss.jboss.security.spi.classpath"/>
+ <path refid="jboss.security.int.classpath"/>
<path refid="jboss.server.classpath"/>
<path refid="jboss.main.classpath"/>
<path refid="jboss.system.classpath"/>
Modified: trunk/connector/src/main/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java 2008-04-01 10:34:18 UTC (rev 71544)
+++ trunk/connector/src/main/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java 2008-04-01 10:35:35 UTC (rev 71545)
@@ -1,24 +1,24 @@
/*
-* 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.
-*/
+ * 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.resource.security;
import java.util.Map;
Modified: trunk/connector/src/main/org/jboss/resource/security/CallerIdentityLoginModule.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/security/CallerIdentityLoginModule.java 2008-04-01 10:34:18 UTC (rev 71544)
+++ trunk/connector/src/main/org/jboss/resource/security/CallerIdentityLoginModule.java 2008-04-01 10:35:35 UTC (rev 71545)
@@ -1,24 +1,24 @@
/*
-* 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.
-*/
+ * 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.resource.security;
import java.security.acl.Group;
Modified: trunk/connector/src/main/org/jboss/resource/security/ConfiguredIdentityLoginModule.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/security/ConfiguredIdentityLoginModule.java 2008-04-01 10:34:18 UTC (rev 71544)
+++ trunk/connector/src/main/org/jboss/resource/security/ConfiguredIdentityLoginModule.java 2008-04-01 10:35:35 UTC (rev 71545)
@@ -1,24 +1,24 @@
/*
-* 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.
-*/
+ * 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.resource.security;
Modified: trunk/connector/src/main/org/jboss/resource/security/GetPrincipalInfoAction.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/security/GetPrincipalInfoAction.java 2008-04-01 10:34:18 UTC (rev 71544)
+++ trunk/connector/src/main/org/jboss/resource/security/GetPrincipalInfoAction.java 2008-04-01 10:35:35 UTC (rev 71545)
@@ -1,24 +1,24 @@
/*
-* 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.
-*/
+ * 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.resource.security;
import java.security.AccessController;
Modified: trunk/connector/src/main/org/jboss/resource/security/JaasSecurityDomainIdentityLoginModule.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/security/JaasSecurityDomainIdentityLoginModule.java 2008-04-01 10:34:18 UTC (rev 71544)
+++ trunk/connector/src/main/org/jboss/resource/security/JaasSecurityDomainIdentityLoginModule.java 2008-04-01 10:35:35 UTC (rev 71545)
@@ -1,24 +1,24 @@
/*
-* 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.
-*/
+ * 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.resource.security;
import java.security.acl.Group;
Added: trunk/connector/src/main/org/jboss/resource/security/PBEIdentityLoginModule.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/security/PBEIdentityLoginModule.java (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/security/PBEIdentityLoginModule.java 2008-04-01 10:35:35 UTC (rev 71545)
@@ -0,0 +1,270 @@
+/*
+ * 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.resource.security;
+
+import java.security.acl.Group;
+import java.security.Principal;
+import java.util.Map;
+import javax.resource.spi.security.PasswordCredential;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.LoginException;
+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.security.Base64Utils;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.Util;
+import org.jboss.logging.Logger;
+
+/** An example of how one could encrypt the database password for a jca
+ connection factory. The corresponding login config entry illustrates
+ the usage:
+
+ <application-policy name = "testPBEIdentityLoginModule">
+ <authentication>
+ <login-module code = "org.jboss.resource.security.PBEIdentityLoginModule"
+ flag = "required">
+ <module-option name = "principal">sa</module-option>
+ <module-option name = "userName">sa</module-option>
+ <!--
+ output from:
+ org.jboss.resource.security.PBEIdentityLoginModule
+ thesecret testPBEIdentityLoginModule abcdefgh 19 PBEWithMD5AndDES
+ -->
+ <module-option name = "password">3fp7R/7TMjyTTxhmePdJVk</module-option>
+ <module-option name = "ignoreMissigingMCF">true</module-option>
+ <module-option name = "pbealgo">PBEWithMD5AndDES</module-option>
+ <module-option name = "pbepass">testPBEIdentityLoginModule</module-option>
+ <module-option name = "salt">abcdefgh</module-option>
+ <module-option name = "iterationCount">19</module-option>
+ <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ This uses password based encryption (PBE) with algorithm parameters dervived
+ from pbealgo, pbepass, salt, iterationCount options:
+ + pbealgo - the PBE algorithm to use. Defaults to PBEwithMD5andDES.
+ + pbepass - the PBE password to use. Can use the JaasSecurityDomain {CLASS}
+ and {EXT} syntax to obtain the password from outside of the configuration.
+ Defaults to "jaas is the way".
+ + salt - the PBE salt as a string. Defaults to {1, 7, 2, 9, 3, 11, 4, 13}.
+ + iterationCount - the PBE iterationCount. Defaults to 37.
+
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:noel.rocher at jboss.org">Noel Rocher</a> 29, june 2004 username & userName issue
+ * @version $Revision: 57189 $
+ */
+public class PBEIdentityLoginModule
+ extends AbstractPasswordCredentialLoginModule
+{
+ /**
+ * Class logger
+ */
+ private static final Logger log = Logger.getLogger(SecureIdentityLoginModule.class);
+
+ private String username;
+ private String password;
+ /** The Blowfish key material */
+ private char[] pbepass = "jaas is the way".toCharArray();
+ private String pbealgo = "PBEwithMD5andDES";
+ private byte[] salt = {1, 7, 2, 9, 3, 11, 4, 13};
+ private int iterationCount = 37;
+ private PBEParameterSpec cipherSpec;
+
+ public PBEIdentityLoginModule()
+ {
+ }
+ PBEIdentityLoginModule(String algo, char[] pass, byte[] pbesalt, int iter)
+ {
+ if( pass != null )
+ pbepass = pass;
+ if( algo != null )
+ pbealgo = algo;
+ if( pbesalt != null )
+ salt = pbesalt;
+ if( iter > 0 )
+ iterationCount = iter;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void initialize(Subject subject, CallbackHandler handler, Map sharedState, Map options)
+ {
+ super.initialize(subject, handler, sharedState, options);
+ // NR : we keep this username for compatibility
+ username = (String) options.get("username");
+ if( username == null )
+ {
+ // NR : try with userName
+ username = (String) options.get("userName");
+ if( username == null )
+ {
+ throw new IllegalArgumentException("The user name is a required option");
+ }
+ }
+ password = (String) options.get("password");
+ if( password == null )
+ {
+ throw new IllegalArgumentException("The password is a required option");
+ }
+ // Look for the cipher password and algo parameters
+ String tmp = (String) options.get("pbepass");
+ if( tmp != null )
+ {
+ try
+ {
+ pbepass = Util.loadPassword(tmp);
+ }
+ catch(Exception e)
+ {
+ throw new IllegalStateException(e);
+ }
+ }
+ tmp = (String) options.get("pbealgo");
+ if( tmp != null )
+ pbealgo = tmp;
+ tmp = (String) options.get("salt");
+ if( tmp != null )
+ salt = tmp.substring(0, 8).getBytes();
+ tmp = (String) options.get("iterationCount");
+ if( tmp != null )
+ iterationCount = Integer.parseInt(tmp);
+ }
+
+ public boolean login() throws LoginException
+ {
+ log.trace("login called");
+ if( super.login() == true )
+ return true;
+
+ super.loginOk = true;
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean commit() throws LoginException
+ {
+ Principal principal = new SimplePrincipal(username);
+ SubjectActions.addPrincipals(subject, principal);
+ sharedState.put("javax.security.auth.login.name", username);
+ // Decode the encrypted password
+ try
+ {
+ char[] decodedPassword = decode(password);
+ PasswordCredential cred = new PasswordCredential(username, decodedPassword);
+ cred.setManagedConnectionFactory(getMcf());
+ SubjectActions.addCredentials(subject, cred);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to decode password", e);
+ throw new LoginException("Failed to decode password: "+e.getMessage());
+ }
+ return true;
+ }
+
+ public boolean abort()
+ {
+ username = null;
+ password = null;
+ return true;
+ }
+
+ protected Principal getIdentity()
+ {
+ log.trace("getIdentity called, username="+username);
+ Principal principal = new SimplePrincipal(username);
+ return principal;
+ }
+
+ protected Group[] getRoleSets() throws LoginException
+ {
+ Group[] empty = new Group[0];
+ return empty;
+ }
+
+ private String encode(String secret)
+ throws Exception
+ {
+ // Create the PBE secret key
+ cipherSpec = new PBEParameterSpec(salt, iterationCount);
+ PBEKeySpec keySpec = new PBEKeySpec(pbepass);
+ SecretKeyFactory factory = SecretKeyFactory.getInstance(pbealgo);
+ SecretKey cipherKey = factory.generateSecret(keySpec);
+
+ // Decode the secret
+ Cipher cipher = Cipher.getInstance(pbealgo);
+ cipher.init(Cipher.ENCRYPT_MODE, cipherKey, cipherSpec);
+ byte[] encoding = cipher.doFinal(secret.getBytes());
+ return Base64Utils.tob64(encoding);
+ }
+
+ private char[] decode(String secret)
+ throws Exception
+ {
+ // Create the PBE secret key
+ cipherSpec = new PBEParameterSpec(salt, iterationCount);
+ PBEKeySpec keySpec = new PBEKeySpec(pbepass);
+ SecretKeyFactory factory = SecretKeyFactory.getInstance(pbealgo);
+ SecretKey cipherKey = factory.generateSecret(keySpec);
+ // Decode the secret
+ byte[] encoding = Base64Utils.fromb64(secret);
+ Cipher cipher = Cipher.getInstance(pbealgo);
+ cipher.init(Cipher.DECRYPT_MODE, cipherKey, cipherSpec);
+ byte[] decode = cipher.doFinal(encoding);
+ return new String(decode).toCharArray();
+ }
+
+ /** Main entry point to encrypt a password using the hard-coded pass phrase
+ *
+ * @param args - [0] = the password to encode
+ * [1] = PBE password
+ * [2] = PBE salt
+ * [3] = PBE iterationCount
+ * [4] = PBE algo
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception
+ {
+ String algo = null;
+ char[] pass = "jaas is the way".toCharArray();
+ byte[] salt = null;
+ int iter = -1;
+ if( args.length >= 2 )
+ pass = args[1].toCharArray();
+ if( args.length >= 3 )
+ salt = args[2].getBytes();
+ if( args.length >= 4 )
+ iter = Integer.decode(args[3]).intValue();
+ if( args.length >= 5 )
+ algo = args[4];
+
+ PBEIdentityLoginModule pbe = new PBEIdentityLoginModule(algo, pass, salt, iter);
+ String encode = pbe.encode(args[0]);
+ System.out.println("Encoded password: "+encode);
+ }
+}
Property changes on: trunk/connector/src/main/org/jboss/resource/security/PBEIdentityLoginModule.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/connector/src/main/org/jboss/resource/security/SecureIdentityLoginModule.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/security/SecureIdentityLoginModule.java 2008-04-01 10:34:18 UTC (rev 71544)
+++ trunk/connector/src/main/org/jboss/resource/security/SecureIdentityLoginModule.java 2008-04-01 10:35:35 UTC (rev 71545)
@@ -1,24 +1,24 @@
/*
-* 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.
-*/
+ * 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.resource.security;
import java.security.acl.Group;
Modified: trunk/connector/src/main/org/jboss/resource/security/SubjectActions.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/security/SubjectActions.java 2008-04-01 10:34:18 UTC (rev 71544)
+++ trunk/connector/src/main/org/jboss/resource/security/SubjectActions.java 2008-04-01 10:35:35 UTC (rev 71545)
@@ -1,24 +1,24 @@
/*
-* 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.
-*/
+ * 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.resource.security;
import java.security.AccessController;
@@ -35,6 +35,7 @@
/**
* Common package privileged actions.
+ *
* @author Scott.Stark at jboss.org
* @version $Revision$
*/
@@ -72,59 +73,51 @@
{
Subject subject;
PasswordCredential cred;
-
AddCredentialsAction(Subject subject, PasswordCredential cred)
{
this.subject = subject;
this.cred = cred;
}
-
public Object run()
{
subject.getPrivateCredentials().add(cred);
return null;
}
}
-
static class AddPrincipalsAction implements PrivilegedAction
{
Subject subject;
Principal p;
-
AddPrincipalsAction(Subject subject, Principal p)
{
this.subject = subject;
this.p = p;
}
-
public Object run()
{
subject.getPrincipals().add(p);
return null;
}
}
-
static class RemoveCredentialsAction implements PrivilegedAction
{
Subject subject;
ManagedConnectionFactory mcf;
-
RemoveCredentialsAction(Subject subject, ManagedConnectionFactory mcf)
{
this.subject = subject;
this.mcf = mcf;
}
-
public Object run()
{
Iterator i = subject.getPrivateCredentials().iterator();
- while (i.hasNext())
+ while( i.hasNext() )
{
Object o = i.next();
- if (o instanceof PasswordCredential)
+ if ( o instanceof PasswordCredential )
{
PasswordCredential pc = (PasswordCredential) o;
- if (pc.getManagedConnectionFactory() == mcf)
+ if( pc.getManagedConnectionFactory() == mcf )
i.remove();
}
}
@@ -137,13 +130,11 @@
AddCredentialsAction action = new AddCredentialsAction(subject, cred);
AccessController.doPrivileged(action);
}
-
static void addPrincipals(Subject subject, Principal p)
{
AddPrincipalsAction action = new AddPrincipalsAction(subject, p);
AccessController.doPrivileged(action);
}
-
static void removeCredentials(Subject subject, ManagedConnectionFactory mcf)
{
RemoveCredentialsAction action = new RemoveCredentialsAction(subject, mcf);
More information about the jboss-cvs-commits
mailing list