[jboss-cvs] JBossAS SVN: r100047 - trunk/security/src/main/java/org/jboss/security/plugins.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 28 09:04:30 EST 2010
Author: mmoyses
Date: 2010-01-28 09:04:29 -0500 (Thu, 28 Jan 2010)
New Revision: 100047
Modified:
trunk/security/src/main/java/org/jboss/security/plugins/JaasSecurityDomain.java
trunk/security/src/main/java/org/jboss/security/plugins/JaasSecurityDomainMBean.java
Log:
JBAS-7668: added options for provider's argument
Modified: trunk/security/src/main/java/org/jboss/security/plugins/JaasSecurityDomain.java
===================================================================
--- trunk/security/src/main/java/org/jboss/security/plugins/JaasSecurityDomain.java 2010-01-28 13:57:58 UTC (rev 100046)
+++ trunk/security/src/main/java/org/jboss/security/plugins/JaasSecurityDomain.java 2010-01-28 14:04:29 UTC (rev 100047)
@@ -24,9 +24,11 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Constructor;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.KeyStore;
+import java.security.Provider;
import java.util.Arrays;
import javax.crypto.Cipher;
@@ -169,6 +171,10 @@
private String keyMgrFactoryAlgorithm;
private String trustMgrFactoryAlgorithm;
+
+ private String keyStoreProviderArgument;
+
+ private String trustStoreProviderArgument;
/** Specify the SecurityManagement instance */
private ISecurityManagement securityManagement = new JNDIBasedSecurityManagement();
@@ -704,6 +710,48 @@
{
this.trustMgrFactoryAlgorithm = algorithm;
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.security.plugins.JaasSecurityDomainMBean#getKeyStoreProviderArgument
+ */
+ @ManagementProperty(use = {ViewUse.CONFIGURATION}, description = "The argument of the KeyStore provider constructor")
+ public String getKeyStoreProviderArgument()
+ {
+ return keyStoreProviderArgument;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.security.plugins.JaasSecurityDomainMBean#setKeyStoreProviderArgument(java.lang.String)
+ */
+ public void setKeyStoreProviderArgument(String argument)
+ {
+ this.keyStoreProviderArgument = argument;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.security.plugins.JaasSecurityDomainMBean#getTrustStoreProviderArgument
+ */
+ @ManagementProperty(use = {ViewUse.CONFIGURATION}, description = "The argument of the TrustStore provider constructor")
+ public String getTrustStoreProviderArgument()
+ {
+ return trustStoreProviderArgument;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.security.plugins.JaasSecurityDomainMBean#setTrustStoreProviderArgument(java.lang.String)
+ */
+ public void setTrustStoreProviderArgument(String argument)
+ {
+ this.trustStoreProviderArgument = argument;
+ }
/*
* (non-Javadoc)
@@ -796,7 +844,20 @@
if (keyStorePassword != null)
{
if (keyStoreProvider != null)
- keyStore = KeyStore.getInstance(keyStoreType, keyStoreProvider);
+ {
+ if (keyStoreProviderArgument != null)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class clazz = loader.loadClass(keyStoreProvider);
+ Class[] ctorSig = {String.class};
+ Constructor ctor = clazz.getConstructor(ctorSig);
+ Object[] ctorArgs = {keyStoreProviderArgument};
+ Provider provider = (Provider) ctor.newInstance(ctorArgs);
+ keyStore = KeyStore.getInstance(keyStoreType, provider);
+ }
+ else
+ keyStore = KeyStore.getInstance(keyStoreType, keyStoreProvider);
+ }
else
keyStore = KeyStore.getInstance(keyStoreType);
InputStream is = null;
@@ -831,7 +892,20 @@
if (trustStorePassword != null)
{
if (trustStoreProvider != null)
- trustStore = KeyStore.getInstance(trustStoreType, trustStoreProvider);
+ {
+ if (trustStoreProviderArgument != null)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class clazz = loader.loadClass(trustStoreProvider);
+ Class[] ctorSig = {String.class};
+ Constructor ctor = clazz.getConstructor(ctorSig);
+ Object[] ctorArgs = {trustStoreProviderArgument};
+ Provider provider = (Provider) ctor.newInstance(ctorArgs);
+ trustStore = KeyStore.getInstance(trustStoreType, provider);
+ }
+ else
+ trustStore = KeyStore.getInstance(trustStoreType, trustStoreProvider);
+ }
else
trustStore = KeyStore.getInstance(trustStoreType);
InputStream is = null;
Modified: trunk/security/src/main/java/org/jboss/security/plugins/JaasSecurityDomainMBean.java
===================================================================
--- trunk/security/src/main/java/org/jboss/security/plugins/JaasSecurityDomainMBean.java 2010-01-28 13:57:58 UTC (rev 100046)
+++ trunk/security/src/main/java/org/jboss/security/plugins/JaasSecurityDomainMBean.java 2010-01-28 14:04:29 UTC (rev 100047)
@@ -203,4 +203,28 @@
* @param algorithm algorithm of the TrustManagerFactory
*/
public void setTrustManagerFactoryAlgorithm(String algorithm);
+
+ /**
+ * Returns the argument for the KeyStore provider constructor
+ * @return argument for the KeyStore provider
+ */
+ public String getKeyStoreProviderArgument();
+
+ /**
+ * Sets the argument for the KeyStore provider constructor
+ * @param argument for the KeyStore provider
+ */
+ public void setKeyStoreProviderArgument(String argument);
+
+ /**
+ * Returns the argument for the TrustStore provider constructor
+ * @return argument for the TrustStore provider
+ */
+ public String getTrustStoreProviderArgument();
+
+ /**
+ * Sets the argument for the TrustStore provider constructor
+ * @param argument for the TrustStore provider
+ */
+ public void setTrustStoreProviderArgument(String argument);
}
More information about the jboss-cvs-commits
mailing list