Skip to content

Create a TrustManagerFactoryBean for a simpler config of HttpsUrlConnectionMessageSender [SWS-731] #821

@gregturn

Description

@gregturn

Leif Hanack opened SWS-731 and commented

The HttpsUrlConnectionMessageSender allow you to set the keyManagers and trustManagers. It would be cool, if Spring Webservice provides s.th. like a KeyManagerFactoryBean and a TrustManagerFactoryBean, so that you can easily secured a webservice connection.

These beans should hide the glue code for creating these managers.

// s.th. like this (only one and no error handling and all that)
public TrustManager[] getTrustManagers() {
  TrustManagerFactory factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
  factory.init(keyStore);
  return factory.getTrustManagers();
}

A config file might look like this:

  <bean id="messageSender" class="org.springframework.ws.transport.http.HttpsUrlConnectionMessageSender">
    <property name="trustManagers" ref="trustManagers"/>
  </bean>

  <bean id="trustManagers" class="org.springframework.ws.soap.security.support.TrustManagerFactoryBean">
    <constructor-arg type="java.security.KeyStore"><ref bean="keyStore"></constructor-arg>
    <!-- next managers .. -->
  </bean>

  <bean id="keyStore" class="org.springframework.ws.soap.security.support.KeyStoreFactoryBean">
    ..
  </bean>

Affects: 2.0.2

Referenced from: commits 9f4e293

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions