<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements. See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership. The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License. You may obtain a copy of the License at
  
  http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied. See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:cxf="http://cxf.apache.org/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:sec="http://cxf.apache.org/configuration/security"
    xmlns:http="http://cxf.apache.org/transports/http/configuration"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <cxf:bus>
        <cxf:features>
            <bean class="org.apache.cxf.ext.logging.LoggingFeature"/>
        </cxf:features>
    </cxf:bus>
    <jaxws:client name="{http://apache.org/hello_world_soap_http}SoapPort" createdFromAPI="true">
        <jaxws:properties>
            <entry key="security.signature.properties" value="clientKeystore.properties"/>
            <entry key="security.signature.username" value="myclientkey"/>
            <entry key="security.callback-handler" value="demo.wssec.client.ClientCallbackHandler"/>
            <entry key="security.encryption.properties" value="clientKeystore.properties"/>
            <entry key="security.encryption.username" value="myservicekey"/>
            <entry key="security.sts.client">
                <bean class="org.apache.cxf.ws.security.trust.STSClient">
                    <constructor-arg ref="cxf"/>
                    <property name="wsdlLocation" value="http://localhost:8080/SecurityTokenService/UT?wsdl"/>
                    <property name="serviceName" value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService"/>
                    <property name="endpointName" value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}UT_Port"/>
                    <property name="properties">
                        <map>
                            <entry key="security.username" value="alice"/>
                            <entry key="security.callback-handler" value="demo.wssec.client.ClientCallbackHandler"/>
                            <entry key="security.encryption.properties" value="clientKeystore.properties"/>
                            <entry key="security.encryption.username" value="mystskey"/>
                            <!-- Because of the PublicKey requirement in the InitiatorToken element
                                in the WSP WSDL, the client needs to have the STS add its public
                                key to the SAML assertion, as configured in the three lines below.  
                           -->
                            <entry key="security.sts.token.username" value="myclientkey"/>
                            <entry key="security.sts.token.properties" value="clientKeystore.properties"/>
                            <!-- If usecert = true, sends entire certificate in an X509Certificate element, else
                                sends cert ID in a KeyValue element -->
                            <entry key="security.sts.token.usecert" value="true"/>
                        </map>
                    </property>
                </bean>
            </entry>
        </jaxws:properties>
    </jaxws:client>
</beans>