WS-TrustPage edited by Colm O hEigeartaighChanges (8)
Full ContentWS-TrustWS-Trust support in CXF builds upon the WS-SecurityPolicy implementation to handle the IssuedToken policy assertions that could be found in the WS-SecurityPolicy fragment. Note: Because the WS-IssuedToken support builds on the WS-SecurityPolicy support, this is currently only available to "wsdl first" projects. WS-Trust extends the WS-Security specification to allow issuing, renewing, and validation of security tokens. A lot of what WS-Trust does centers around the use of a "Security Token Service", or STS. The STS is contacted to obtain security tokens that are used to create messages to talk to the services. The primary use of the STS is to acquire SAML tokens used to talk to the service. Why is this interesting? When using "straight" WS-Security, the client and server need to have keys exchanged in advance. If the client and server are both in the same security domain, that isn't usually a problem, but for larger, complex applications spanning multiple domains, that can be a burden. Also, if multiple services require the same security credentials, updating all the services when those credentials change can by a major operation. WS-Trust solves this by using security tokens that are obtained from a trusted Security Token Service. A client authenticates itself with the STS based on policies and requirements defined by the STS. The STS then provides a security token (example: a SAML token) that the client then uses to talk to the target service. The service can validate that token to make sure it really came from the trusted STS. When the WS-SecurityPolicy runtime in CXF encounters an IssuedToken assertion in the policy, the runtime requires an instance of org.apache.cxf.ws.security.trust.STSClient to talk to the STS to obtain the required token. Since the STSClient is a WS-SecurityPolicy client, it will need configuration items to be able to create its secure SOAP messages to talk to the STS. General ConfigurationThere are several ways to configure the STSClient: Direct configuration of an STSClient bean in the properties: <jaxws:client name="{http://cxf.apache.org/}MyService" createdFromAPI="true"> <jaxws:properties> <entry key="ws-security.sts.client"> <!-- direct STSClient config and creation --> <bean class="org.apache.cxf.ws.security.trust.STSClient"> <constructor-arg ref="cxf"/> <property name="wsdlLocation" value="target/wsdl/trust.wsdl"/> <property name="serviceName" value="{http://cxf.apache.org/securitytokenservice}SecurityTokenService"/> <property name="endpointName" value="{http://cxf.apache.org/securitytokenservice}SecurityTokenEndpoint"/> <property name="properties"> <map> <entry key="ws-security.username" value="alice"/> <entry key="ws-security.callback-handler" value="client.MyCallbackHandler"/> <entry key="ws-security.signature.properties" value="clientKeystore.properties"/> <entry key="ws-security.encryption.properties" value="clientKeystore.properties"/> <entry key="ws-security.encryption.username" value="mystskey"/> </map> </property> </bean> </entry> </jaxws:properties> </jaxws:client>
For example, the following code fragment demonstrates how to use an interceptor to dynamically set the content of the ActAs element in the STS RST, by specifying a value for SecurityConstants.STS_TOKEN_ACT_AS. Note that this interceptor is applied to the secured client, the initiator, and not to the STSClient's interceptor chain. public class ActAsOutInterceptor extends AbstractPhaseInterceptor<Message> { ActAsOutInterceptor () { // This can be in any stage before the WS-SP interceptors // setup the STS client and issued token interceptor. super(Phase.SETUP); } @Override public void handleMessage(Message message) throws Fault { message.put(SecurityConstants.STS_TOKEN_ACT_AS, ...); } } Alternatively, the ActAs content may be set directly on the STS as shown below. <bean name="{http://cxf.apache.org/}TestEndpoint.sts-client" class="org.apache.cxf.ws.security.trust.STSClient" abstract="true"> <property name="wsdlLocation" value="WSDL/wsdl/trust.wsdl"/> <property name="serviceName" value="{http://cxf.apache.org/securitytokenservice}SecurityTokenService"/> <property name="endpointName" value="{http://cxf.apache.org/securitytokenservice}SecurityTokenEndpoint"/> <property name="actAs" value="..."/> <property name="properties"> <map> ... </map> </property> </bean> OnBehalfOfThe OnBehalfOf capability allows an initiator to request a security token on behalf of somebody else. The content of the OnBehalfOf element to be sent in the STS RequestSecurityToken call can be set in one of two ways:
For either case, the value can be one of the following:
WS-Trust using SPNegoAs of CXF 2.4.7 and 2.5.3, CXF contains (client) support for WS-Trust using SPNego. See the following blog for an explanation of what this entails, and how to run some system tests in CXF for this feature. Blogs on WS-Trust in CXFSome blogs for up-to-date information about WS-Trust and other security topics in CXF:
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache CXF Documentation > WS-Trust confluence
- [CONF] Apache CXF Documentation > WS-Trust confluence
- [CONF] Apache CXF Documentation > WS-Trust confluence
