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


    <spring:bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
        <spring:property name="userMap">
            <spring:value>
                ross=ross,ROLE_ADMIN
                anon=anon,ROLE_ANONYMOUS
            </spring:value>
        </spring:property>
    </spring:bean>

    <spring:bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
        <spring:property name="userDetailsService" ref="inMemoryDaoImpl"/>
    </spring:bean>

    <spring:bean name="echoComponent" class="org.mule.component.simple.EchoComponent"/>

    <acegi:security-manager>
        <acegi:delegate-security-provider name="memory-dao" delegate-ref="daoAuthenticationProvider"/>
    </acegi:security-manager>


    <!-- this sets the same provider three times, once through acegi's provider and twice
         through a custom provider.  in normal use it should be set just once, through
         the acegi schema - this is just for extra test coverage -->

    <spring:bean id="explicitCreation1" class="org.mule.module.acegi.AcegiProviderAdapter">
        <spring:property name="delegate" ref="daoAuthenticationProvider"/>
        <spring:property name="name" value="customProvider"/>
    </spring:bean>

    <security-manager>
        <custom-security-provider name="willNotOverwriteName" provider-ref="explicitCreation1"/>
    </security-manager>

    <spring:bean id="explicitCreation2" class="org.mule.module.acegi.AcegiProviderAdapter">
        <spring:property name="delegate" ref="daoAuthenticationProvider"/>
    </spring:bean>

    <security-manager>
        <custom-security-provider name="willOverwriteName" provider-ref="explicitCreation2"/>
    </security-manager>

</mule>
