...
ws-security.username | The username used for UsernameToken policy assertions |
ws-security.password | The password used for UsernameToken policy assertions. If not specified, the callback handler will be called. |
ws-security.callback-handler | The WSS4J security CallbackHandler that will be used to retrieve passwords for keystores and UsernameTokens. |
ws-security.signature.properties | The properties file/object that contains the WSS4J properties for configuring the signature keystore and crypto objects |
ws-security.encryption.properties | The properties file/object that contains the WSS4J properties for configuring the encryption keystore and crypto objects |
ws-security.signature.username | The username or alias for the key in the signature keystore that will be used. If not specified, it uses the the default alias set in the properties file. If that's also not set, and the keystore only contains a single key, that key will be used. |
ws-security.encryption.username | The username or alias for the key in the encryption keystore that will be used. If not specified, it uses the the default alias set in the properties file. If that's also not set, and the keystore only contains a single key, that key will be used. For the web service provider, the useReqSigCert keyword can be used to accept (encrypt to) any client whose public key is in the service's truststore (defined in ws-security.encryption.properties.) |
ws-security.signature.crypto | Instead of specifying the signature properties, this can point to the full WSS4J Crypto object. This can allow easier "programmatic" configuration of the Crypto information." |
ws-security.encryption.crypto | Instead of specifying the encryption properties, this can point to the full WSS4J Crypto object. This can allow easier "programmatic" configuration of the Crypto information." |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <jaxws:client name="{http://cxf.apache.org}MyPortName" createdFromAPI="true"> <jaxws:properties> <entry key="ws-security.usernamecallback-handler" value="Aliceinterop.client.KeystorePasswordCallback"/> <entry key="ws-security.callback-handlersignature.properties" value="interop.etc/client.KeystorePasswordCallbackproperties"/> <entry key="ws-security.signatureencryption.properties" value="etc/aliceservice.properties"/> <entry key="ws-security.encryption.propertiesusername" value="etc/bob.propertiesservicekeyalias"/> </jaxws:properties> </jaxws:client> </beans> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <jaxws:endpoint id="MyService" address="https://localhost:9001/MyService" serviceName="interop:MyService" endpointName="interop:MyServiceEndpoint" implementor="com.foo.MyService"> <jaxws:properties> <entry key="ws-security.callback-handler" value="interop.client.UTPasswordCallback"/> <entry key="ws-security.signature.properties" value="etc/bobkeystore.properties"/> <entry key="ws-security.encryption.properties" value="etc/alicetruststore.properties"/> <entry key="ws-security.encryption.username" value="useReqSigCert"/> </jaxws:properties> </jaxws:endpoint> </beans> |
See this blog entry for a more end-to-end example of using WS-SecurityPolicy with X.509 keys.
Configuring via API's
Configuring the properties for the client just involves setting the properties in the clients client's RequestContext:
Code Block | ||||
---|---|---|---|---|
| ||||
Map<String, Object> ctx = ((BindingProvider)port).getRequestContext(); ctx.put("ws-security.encryption.properties", properties); port.echoString("hello"); |