You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/06/13 16:07:58 UTC
svn commit: r413902 - in
/incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms:
JmsConfiguration.java JmsConfigurationMBean.java JmsEndpoint.java
JmsLifeCycle.java
Author: gnodet
Date: Tue Jun 13 07:07:58 2006
New Revision: 413902
URL: http://svn.apache.org/viewvc?rev=413902&view=rev
Log:
Modify jms component configuration to provide support for ws-sec
Modified:
incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfiguration.java
incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfigurationMBean.java
incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsEndpoint.java
incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsLifeCycle.java
Modified: incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfiguration.java?rev=413902&r1=413901&r2=413902&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfiguration.java (original)
+++ incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfiguration.java Tue Jun 13 07:07:58 2006
@@ -18,6 +18,8 @@
import javax.jms.ConnectionFactory;
import org.apache.servicemix.common.PersistentConfiguration;
+import org.apache.servicemix.jbi.security.auth.AuthenticationService;
+import org.apache.servicemix.jbi.security.keystore.KeystoreManager;
/**
* @author gnodet
@@ -31,9 +33,72 @@
private String jndiProviderUrl;
private String jndiConnectionFactoryName;
private String processorName = "multiplexing";
- private ConnectionFactory connectionFactory;
+ private transient ConnectionFactory connectionFactory;
+ private transient KeystoreManager keystoreManager;
+ private transient AuthenticationService authenticationService;
/**
+ * The JNDI name of the AuthenticationService object
+ */
+ private String authenticationServiceName = "java:comp/env/smx/AuthenticationService";
+
+ /**
+ * The JNDI name of the KeystoreManager object
+ */
+ private String keystoreManagerName = "java:comp/env/smx/KeystoreManager";
+
+
+ /**
+ * @return the authenticationService
+ */
+ public AuthenticationService getAuthenticationService() {
+ return authenticationService;
+ }
+ /**
+ * @param authenticationService the authenticationService to set
+ */
+ public void setAuthenticationService(AuthenticationService authenticationService) {
+ this.authenticationService = authenticationService;
+ }
+ /**
+ * @return the authenticationServiceName
+ */
+ public String getAuthenticationServiceName() {
+ return authenticationServiceName;
+ }
+ /**
+ * @param authenticationServiceName the authenticationServiceName to set
+ */
+ public void setAuthenticationServiceName(String authenticationServiceName) {
+ this.authenticationServiceName = authenticationServiceName;
+ }
+ /**
+ * @return the keystoreManager
+ */
+ public KeystoreManager getKeystoreManager() {
+ return keystoreManager;
+ }
+ /**
+ * @param keystoreManager the keystoreManager to set
+ */
+ public void setKeystoreManager(KeystoreManager keystoreManager) {
+ this.keystoreManager = keystoreManager;
+ save();
+ }
+ /**
+ * @return the keystoreManagerName
+ */
+ public String getKeystoreManagerName() {
+ return keystoreManagerName;
+ }
+ /**
+ * @param keystoreManagerName the keystoreManagerName to set
+ */
+ public void setKeystoreManagerName(String keystoreManagerName) {
+ this.keystoreManagerName = keystoreManagerName;
+ save();
+ }
+ /**
* @return Returns the password.
*/
public String getPassword() {
@@ -133,6 +198,8 @@
properties.setProperty("jndiProviderUrl", jndiProviderUrl);
properties.setProperty("jndiName", jndiConnectionFactoryName);
properties.setProperty("processorName", processorName);
+ properties.setProperty("keystoreManagerName", keystoreManagerName);
+ properties.setProperty("authenticationServiceName", authenticationServiceName);
super.save();
}
@@ -155,6 +222,12 @@
}
if (properties.getProperty("processorName") != null) {
processorName = properties.getProperty("processorName");
+ }
+ if (properties.getProperty("keystoreManagerName") != null) {
+ keystoreManagerName = properties.getProperty("keystoreManagerName");
+ }
+ if (properties.getProperty("authenticationServiceName") != null) {
+ authenticationServiceName = properties.getProperty("authenticationServiceName");
}
return true;
} else {
Modified: incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfigurationMBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfigurationMBean.java?rev=413902&r1=413901&r2=413902&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfigurationMBean.java (original)
+++ incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsConfigurationMBean.java Tue Jun 13 07:07:58 2006
@@ -65,4 +65,13 @@
* @param processorName The processorName to set.
*/
public void setProcessorName(String processorName);
+
+ public String getKeystoreManagerName();
+
+ public void setKeystoreManagerName(String name);
+
+ public String getAuthenticationServiceName();
+
+ public void setAuthenticationServiceName(String name);
+
}
Modified: incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsEndpoint.java?rev=413902&r1=413901&r2=413902&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsEndpoint.java (original)
+++ incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsEndpoint.java Tue Jun 13 07:07:58 2006
@@ -20,6 +20,7 @@
import java.util.Iterator;
import java.util.Properties;
+import javax.jbi.component.ComponentLifeCycle;
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
@@ -28,6 +29,8 @@
import javax.wsdl.Service;
import org.apache.servicemix.common.ExchangeProcessor;
+import org.apache.servicemix.jbi.security.auth.AuthenticationService;
+import org.apache.servicemix.jbi.security.keystore.KeystoreManager;
import org.apache.servicemix.jms.wsdl.JmsBinding;
import org.apache.servicemix.soap.SoapEndpoint;
@@ -322,6 +325,16 @@
public JmsConfiguration getConfiguration() {
JmsLifeCycle lifeCycle = (JmsLifeCycle) getServiceUnit().getComponent().getLifeCycle();
return lifeCycle.getConfiguration();
+ }
+
+ public AuthenticationService getAuthenticationService() {
+ ComponentLifeCycle lf = getServiceUnit().getComponent().getLifeCycle();
+ return ((JmsLifeCycle) lf).getAuthenticationService();
+ }
+
+ public KeystoreManager getKeystoreManager() {
+ ComponentLifeCycle lf = getServiceUnit().getComponent().getLifeCycle();
+ return ((JmsLifeCycle) lf).getKeystoreManager();
}
}
Modified: incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsLifeCycle.java?rev=413902&r1=413901&r2=413902&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsLifeCycle.java (original)
+++ incubator/servicemix/trunk/servicemix-jms/src/main/java/org/apache/servicemix/jms/JmsLifeCycle.java Tue Jun 13 07:07:58 2006
@@ -28,6 +28,9 @@
import org.apache.servicemix.common.BaseLifeCycle;
import org.apache.servicemix.common.Endpoint;
import org.apache.servicemix.common.ServiceUnit;
+import org.apache.servicemix.jbi.security.auth.AuthenticationService;
+import org.apache.servicemix.jbi.security.auth.impl.JAASAuthenticationService;
+import org.apache.servicemix.jbi.security.keystore.KeystoreManager;
public class JmsLifeCycle extends BaseLifeCycle {
@@ -52,6 +55,25 @@
super.doInit();
configuration.setRootDir(context.getWorkspaceRoot());
configuration.load();
+ // Lookup keystoreManager and authenticationService
+ if (configuration.getKeystoreManager() == null) {
+ try {
+ String name = configuration.getKeystoreManagerName();
+ Object km = context.getNamingContext().lookup(name);
+ configuration.setKeystoreManager((KeystoreManager) km);
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ if (configuration.getAuthenticationService() == null) {
+ try {
+ String name = configuration.getAuthenticationServiceName();
+ Object as = context.getNamingContext().lookup(name);
+ configuration.setAuthenticationService((AuthenticationService) as);
+ } catch (Exception e) {
+ configuration.setAuthenticationService(new JAASAuthenticationService());
+ }
+ }
}
/**
@@ -102,6 +124,34 @@
// TODO: need to find some usefull syntax for jms
// jms://
return jmsEp;
+ }
+
+ /**
+ * @return the keystoreManager
+ */
+ public KeystoreManager getKeystoreManager() {
+ return configuration.getKeystoreManager();
+ }
+
+ /**
+ * @param keystoreManager the keystoreManager to set
+ */
+ public void setKeystoreManager(KeystoreManager keystoreManager) {
+ this.configuration.setKeystoreManager(keystoreManager);
+ }
+
+ /**
+ * @return the authenticationService
+ */
+ public AuthenticationService getAuthenticationService() {
+ return configuration.getAuthenticationService();
+ }
+
+ /**
+ * @param authenticationService the authenticationService to set
+ */
+ public void setAuthenticationService(AuthenticationService authenticationService) {
+ this.configuration.setAuthenticationService(authenticationService);
}
}