<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:security="http://www.springframework.org/schema/security"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                           http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd">

    <description>
        This application context contains the WS-Security and Sprign Security beans.
    </description>

    <security:global-method-security secured-annotations="enabled"/>

    <security:authentication-provider user-service-ref="securityService"/>

    <bean id="securityService"
          class="org.springframework.ws.samples.airline.security.SpringFrequentFlyerSecurityService">
        <description>
            A security service used to obtain Frequent Flyer information.
        </description>
        <constructor-arg ref="frequentFlyerDao"/>
    </bean>

    <bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor">
        <description>
            This interceptor validates incoming messages according to the policy defined in 'securityPolicy.xml'.
            The policy defines that all incoming requests must have a UsernameToken with a password digest in it.
            The actual authentication is performed by the Spring Security callback handler.
        </description>
        <property name="secureResponse" value="false"/>
        <property name="policyConfiguration"
                  value="classpath:org/springframework/ws/samples/airline/security/securityPolicy.xml"/>
        <property name="callbackHandler">
            <bean class="org.springframework.ws.soap.security.xwss.callback.SpringDigestPasswordValidationCallbackHandler">
                <property name="userDetailsService" ref="securityService"/>
            </bean>
        </property>
    </bean>

</beans>