...
constant | default | definition |
ws-security.validate.token | true | Whether to validate the password of a received UsernameToken or not. |
ws-security.enableRevocation | false | Whether to enable Certificate Revocation List (CRL) checking or not when verifying trust in a certificate. |
ws-security.username-token.always.encrypted | true | Whether to always encrypt UsernameTokens that are defined as a SupportingToken. This should not be set to false in a production environment, as it exposes the password (or the digest of the password) on the wire. |
ws-security.is-bsp-compliant | true | Whether to ensure compliance with the Basic Security Profile (BSP) 1.1 or not. |
ws-security.self-sign-saml-assertion | false | Whether to self-sign a SAML Assertion or not. If this is set to true, then an enveloped signature will be generated when the SAML Assertion is constructed. |
ws-security.enable.nonce.cache | (varies) | Whether to cache UsernameToken nonces. See here for more information. |
ws-security.enable.timestamp.cache | (varies) | Whether to cache Timestamp Created Strings. See here for more information. |
ws-security.enable.saml.cache | (varies) | Whether to cache SAML2 Token Identifiers, if the token contains a "OneTimeUse" Condition. |
Non-boolean WS-Security Configuration parameters
ws-security.timestamp.timeToLive | The time in seconds to append to the Creation value of an incoming Timestamp to determine whether to accept the Timestamp as valid or not. The default value is 300 seconds (5 minutes). |
ws-security.timestamp.futureTimeToLive | The time in seconds in the future within which the Created time of an incoming Timestamp is valid. The default value is "60". See here for more information. |
ws-security.saml-role-attributename | The attribute URI of the SAML AttributeStatement where the role information is stored. The default is "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role". |
ws-security.kerberos.client | A reference to the KerberosClient class used to obtain a service ticket. |
ws-security.spnego.client.action | The SpnegoClientAction implementation to use for SPNEGO. This allows the user to plug in a different implementation to obtain a service ticket. |
ws-security.kerberos.jaas.context | The JAAS Context name to use for Kerberos. This is currently only supported for SPNEGO. |
ws-security.kerberos.spn | The Kerberos Service Provider Name (spn) to use. This is currently only supported for SPNEGO. |
ws-security.nonce.cache.instance | This holds a reference to a ReplayCache instance used to cache UsernameToken nonces. The default instance that is used is the EHCacheReplayCache. |
ws-security.timestamp.cache.instance | This holds a reference to a ReplayCache instance used to cache Timestamp Created Strings. The default instance that is used is the EHCacheReplayCache. |
ws-security.saml.cache.instance | This holds a reference to a ReplayCache instance used to cache SAML2 Token Identifiers, when the token has a "OneTimeUse" Condition. The default instance that is used is the EHCacheReplayCache. |
ws-security.cache.config.file | Set this property to point to a configuration file for the underlying caching implementation. The default configuration file that is used is cxf-ehcache.xml in the cxf-rt-ws-security module. |
org.apache.cxf.ws.security.tokenstore.TokenStore | The TokenStore instance to use to cache security tokens. By default this uses the EHCacheTokenStore if EhCache is available. Otherwise it uses the MemoryTokenStore. |
ws-security.subject.cert.constraints | A comma separated String of regular expressions which will be applied to the subject DN of the certificate used for signature validation, after trust verification of the certificate chain associated with the certificate. These constraints are not used when the certificate is contained in the keystore (direct trust). |
ws-security.role.classifier | If one of the WSS4J Validators returns a JAAS Subject from Validation, then the WSS4JInInterceptor will attempt to create a SecurityContext based on this Subject. If this value is not specified, then it tries to get roles using the DefaultSecurityContext in cxf-rt-core. Otherwise it uses this value in combination with the SUBJECT_ROLE_CLASSIFIER_TYPE to get the roles from the Subject. |
ws-security.role.classifier.type | If one of the WSS4J Validators returns a JAAS Subject from Validation, then the WSS4JInInterceptor will attempt to create a SecurityContext based on this Subject. Currently accepted values are "prefix" or "classname". Must be used in conjunction with the SUBJECT_ROLE_CLASSIFIER. The default value is "prefix". |
ws-security.asymmetric.signature.algorithm | This configuration tag overrides the default Asymmetric Signature algorithm (RSA-SHA1) for use in WS-SecurityPolicy, as the WS-SecurityPolicy specification does not allow the use of other algorithms at present. |
...
The properties are easily configured as client or endpoint properties--use the former for the SOAP client, the latter for the web service provider.
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.callback-handler"
value="interop.client.KeystorePasswordCallback"/>
<entry key="ws-security.signature.properties"
value="etc/client.properties"/>
<entry key="ws-security.encryption.properties"
value="etc/service.properties"/>
<entry key="ws-security.encryption.username"
value="servicekeyalias"/>
</jaxws:properties>
</jaxws:client>
</beans>
|
For the jaxws:client's name attribute above, use the namespace of the WSDL along with the name attribute of the desired wsdl:port element under the WSDL's service section. (See here and here for an example.)
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/keystore.properties"/>
<entry key="ws-security.encryption.properties"
value="etc/truststore.properties"/>
<entry key="ws-security.encryption.username"
value="useReqSigCert"/>
</jaxws:properties>
</jaxws:endpoint>
</beans>
|
...
Configuring the properties for the client just involves setting the properties in the client's RequestContext:
Code Block | ||||
---|---|---|---|---|
| ||||
Map<String, Object> ctx = ((BindingProvider)port).getRequestContext();
ctx.put("ws-security.encryption.properties", properties);
port.echoString("hello");
|