Hello All,
I am working on making the keystore and password parameters configurable in
my CXF/Camel Web Service. There is documentation on the CXF web site shows
how to create a passwordCallbackRef as a Spring Bean. This is helpful
because the user (or certificate alias) and password can be injected in and
configured.
Most documentation that I have seen shows how to use a Properties file that
is in the Classpath to configure the keystore properties. For example:
<entry key="signaturePropFile" value="client.properties"/>
I didn't want to bake a properties file into a bundle or WAR and I found
this way to do it with Spring Util Properties
<bean id="wss4jOutInterceptor"
class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Signature"/>
<entry key="user" value="${alias}"/>
<entry key="passwordCallbackRef">
<ref bean="passwordCallbackBean"/>
</entry>
*<entry key="SignaturePropRefId" value="wsCryptoProperties"/>
<entry key="wsCryptoProperties" value-ref="wsCryptoProperties"
/>*
</map>
</constructor-arg>
</bean>
<util:properties id="wsCryptoProperties">
<prop
key="org.apache.ws.security.crypto.provider">org.apache.ws.security.components.crypto.Merlin</prop>
<prop
key="org.apache.ws.security.crypto.merlin.keystore.type">jks</prop>
<prop
key="org.apache.ws.security.crypto.merlin.keystore.password">${KeystorePassword}</prop>
<prop
key="org.apache.ws.security.crypto.merlin.file">${KeystoreLocation}</prop>
</util:properties>
<bean id="passwordCallbackBean"
class="org.mypackage.ws.security.ClientCallback">
<property name="certificateAlias" value="${alias}"/>
<property name="privateKeyPassword"
value="${privateKeyPassword}"/>
</bean>
I think it would be really helpful to have this way of configuring the
keystore properties on the CXF documentation page. Can I go ahead and
update the CXF WIKI?
H/T to David Valero for the the code.
Thanks,
Yogesh
--
View this message in context:
http://cxf.547215.n5.nabble.com/WS-Security-Properties-Reference-tp5505704p5505704.html
Sent from the cxf-user mailing list archive at Nabble.com.