You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sp...@apache.org on 2006/09/27 20:22:21 UTC
svn commit: r450537 [2/2] - in /geronimo/server/branches/sachin: ./
assemblies/ assemblies/geronimo-framework/
assemblies/geronimo-framework/src/ assemblies/geronimo-framework/src/main/
assemblies/geronimo-framework/src/main/assembly/ assemblies/geroni...
Modified: geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java?view=diff&rev=450537&r1=450536&r2=450537
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java Wed Sep 27 11:22:17 2006
@@ -35,14 +35,15 @@
import org.apache.xmlbeans.XmlObject;
/**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
*/
-public class EnvironmentEntryBuilder implements NamingBuilder {
- private static final String J2EE_NAMESPACE = "http://java.sun.com/xml/ns/j2ee";
+public class EnvironmentEntryBuilder extends AbstractNamingBuilder {
- private static final QName ENV_ENTRY_QNAME = new QName(J2EE_NAMESPACE, "env-entry");
- private static final QNameSet ENV_ENTRY_QNAME_SET = QNameSet.singleton(ENV_ENTRY_QNAME);
+ private final QNameSet envEntryQNameSet;
+ public EnvironmentEntryBuilder(String[] eeNamespaces) {
+ envEntryQNameSet = buildQNameSet(eeNamespaces, "env-entry");
+ }
public void buildEnvironment(XmlObject specDD, XmlObject plan, Environment environment) {
}
@@ -50,7 +51,7 @@
}
public void buildNaming(XmlObject specDD, XmlObject plan, Configuration localConfiguration, Configuration remoteConfiguration, Module module, Map componentContext) throws DeploymentException {
- XmlObject[] envEntriesUntyped = specDD.selectChildren(ENV_ENTRY_QNAME_SET);
+ XmlObject[] envEntriesUntyped = specDD.selectChildren(envEntryQNameSet);
for (int i = 0; i < envEntriesUntyped.length; i++) {
EnvEntryType envEntry = (EnvEntryType) envEntriesUntyped[i].copy().changeType(EnvEntryType.type);
String name = envEntry.getEnvEntryName().getStringValue().trim();
@@ -94,7 +95,7 @@
}
public QNameSet getSpecQNameSet() {
- return ENV_ENTRY_QNAME_SET;
+ return envEntryQNameSet;
}
public QNameSet getPlanQNameSet() {
@@ -105,6 +106,8 @@
static {
GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(EnvironmentEntryBuilder.class, NameFactory.MODULE_BUILDER);
+ infoBuilder.addAttribute("eeNamespaces", String[].class, true, true);
+ infoBuilder.setConstructor(new String[] {"eeNamespaces"});
GBEAN_INFO = infoBuilder.getBeanInfo();
}
Modified: geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java?view=diff&rev=450537&r1=450536&r2=450537
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java Wed Sep 27 11:22:17 2006
@@ -39,7 +39,7 @@
*/
public class EnvironmentEntryBuilderTest extends TestCase {
private Map componentContext = new HashMap();
- private NamingBuilder environmentEntryBuilder = new EnvironmentEntryBuilder();
+ private NamingBuilder environmentEntryBuilder = new EnvironmentEntryBuilder(new String[] {AbstractNamingBuilder.J2EE_NAMESPACE});
private static final String TEST = "<tmp xmlns=\"http://java.sun.com/xml/ns/j2ee\">" +
"<env-entry>" +
Modified: geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/DirectConfigurationEntry.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/DirectConfigurationEntry.java?view=diff&rev=450537&r1=450536&r2=450537
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/DirectConfigurationEntry.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/DirectConfigurationEntry.java Wed Sep 27 11:22:17 2006
@@ -34,20 +34,17 @@
private final String applicationConfigName;
private final LoginModuleControlFlag controlFlag;
private final LoginModuleSettings module;
- private final boolean wrapPrincipals;
public DirectConfigurationEntry() {
this.applicationConfigName = null;
this.controlFlag = null;
this.module = null;
- this.wrapPrincipals = false;
}
- public DirectConfigurationEntry(String applicationConfigName, LoginModuleControlFlag controlFlag, LoginModuleSettings module, boolean wrapPrincipals) {
+ public DirectConfigurationEntry(String applicationConfigName, LoginModuleControlFlag controlFlag, LoginModuleSettings module) {
this.applicationConfigName = applicationConfigName;
this.controlFlag = controlFlag;
this.module = module;
- this.wrapPrincipals = wrapPrincipals;
}
public String getConfigurationName() {
@@ -55,7 +52,7 @@
}
public JaasLoginModuleConfiguration generateConfiguration() {
- return new JaasLoginModuleConfiguration(module.getLoginModuleClass(), controlFlag, module.getOptions(), module.isServerSide(), applicationConfigName, wrapPrincipals, module.getClassLoader());
+ return new JaasLoginModuleConfiguration(module.getLoginModuleClass(), controlFlag, module.getOptions(), module.isServerSide(), applicationConfigName, false, module.getClassLoader());
}
public static final GBeanInfo GBEAN_INFO;
@@ -65,11 +62,10 @@
infoFactory.addInterface(ConfigurationEntryFactory.class);
infoFactory.addAttribute("applicationConfigName", String.class, true);
infoFactory.addAttribute("controlFlag", LoginModuleControlFlag.class, true);
- infoFactory.addAttribute("wrapPrincipals", boolean.class, true);
infoFactory.addReference("Module", LoginModuleSettings.class, NameFactory.LOGIN_MODULE);
- infoFactory.setConstructor(new String[]{"applicationConfigName", "controlFlag", "Module", "wrapPrincipals"});
+ infoFactory.setConstructor(new String[]{"applicationConfigName", "controlFlag", "Module"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Modified: geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java?view=diff&rev=450537&r1=450536&r2=450537
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-security/src/main/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java Wed Sep 27 11:22:17 2006
@@ -335,7 +335,7 @@
PKCS10CertificationRequest csr = new PKCS10CertificationRequest(sigalg,
subject, publicKey, attributes, signingKey);
-
+
if (!csr.verify()) {
throw new KeyStoreException("CSR verification failed");
}
@@ -344,26 +344,26 @@
DEROutputStream deros = new DEROutputStream(os);
deros.writeObject(csr.getDERObject());
String b64 = new String(Base64.encode(os.toByteArray()));
-
+
final String BEGIN_CERT_REQ = "-----BEGIN CERTIFICATE REQUEST-----";
final String END_CERT_REQ = "-----END CERTIFICATE REQUEST-----";
final int CERT_REQ_LINE_LENGTH = 70;
-
+
StringBuffer sbuf = new StringBuffer(BEGIN_CERT_REQ).append('\n');
-
+
int idx = 0;
while (idx < b64.length()) {
-
+
int len = (idx + CERT_REQ_LINE_LENGTH > b64.length()) ? b64
.length()
- idx : CERT_REQ_LINE_LENGTH;
-
+
String chunk = b64.substring(idx, idx + len);
-
+
sbuf.append(chunk).append('\n');
idx += len;
}
-
+
sbuf.append(END_CERT_REQ);
return sbuf.toString();
}
@@ -375,7 +375,7 @@
java.security.NoSuchAlgorithmException,
java.security.UnrecoverableKeyException, java.io.IOException {
InputStream is = null;
-
+
try {
is = new ByteArrayInputStream(certbuf.getBytes());
importPKCS7Certificate(alias, is);
@@ -397,18 +397,18 @@
java.security.UnrecoverableKeyException, java.io.IOException {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Collection certcoll = cf.generateCertificates(is);
-
+
Certificate[] chain = new Certificate[certcoll.size()];
-
+
Iterator iter = certcoll.iterator();
for (int i = 0; iter.hasNext(); i++) {
chain[i] = (Certificate) iter.next();
}
-
+
char[] keyPassword = (char[])keyPasswords.get(alias);
keystore.setKeyEntry(alias, keystore.getKey(alias, keyPassword), keyPassword,
chain);
-
+
saveKeystore(keystorePassword);
}
@@ -417,13 +417,16 @@
keystore.deleteEntry(alias);
privateKeys.remove(alias);
trustCerts.remove(alias);
- keyPasswords.remove(alias);
+ if (keyPasswords.containsKey(alias)) {
+ keyPasswords.remove(alias);
+ storePasswords();
+ }
} catch (KeyStoreException e) {
- log.error("Unable to delete entry:"+alias, e);
+ log.error("Unable to delete entry:" + alias, e);
}
saveKeystore(keystorePassword);
}
-
+
public KeyManager[] getKeyManager(String algorithm, String alias) throws NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeystoreIsLocked {
if(isKeystoreLocked()) {
throw new KeystoreIsLocked("Keystore '"+keystoreName+"' is locked; please unlock it in the console.");
Modified: geronimo/server/branches/sachin/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java?view=diff&rev=450537&r1=450536&r2=450537
==============================================================================
--- geronimo/server/branches/sachin/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java (original)
+++ geronimo/server/branches/sachin/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/LoginPropertiesFileTest.java Wed Sep 27 11:22:17 2006
@@ -64,7 +64,6 @@
clientCE = gbean.getAbstractName();
gbean.setAttribute("applicationConfigName", "properties-client");
gbean.setAttribute("controlFlag", LoginModuleControlFlag.REQUIRED);
- gbean.setAttribute("wrapPrincipals", Boolean.TRUE);
gbean.setReferencePattern("Module", clientLM);
kernel.loadGBean(gbean, DirectConfigurationEntry.class.getClassLoader());
Modified: geronimo/server/branches/sachin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/sachin/pom.xml?view=diff&rev=450537&r1=450536&r2=450537
==============================================================================
--- geronimo/server/branches/sachin/pom.xml (original)
+++ geronimo/server/branches/sachin/pom.xml Wed Sep 27 11:22:17 2006
@@ -939,7 +939,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-rar-plugin</artifactId>
- <version>2.1</version>
+ <version>2.2-SNAPSHOT</version>
<configuration>
<archive>
<!-- Do not include META-INF/maven to avoid long file problems on windows -->