<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
  ~ JOSSO: Java Open Single Sign-On
  ~
  ~ Copyright 2004-2009, Atricore, Inc.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  ~
  -->

<s:beans xmlns:s="http://www.springframework.org/schema/beans"
       xmlns="urn:org:josso:core"
       xmlns:def-sdselector="urn:org:josso:default:secdomainselector"
       xmlns:def-sdregistry="urn:org:josso:default:secdomainregistry"
       xmlns:simple-sdmatcher="urn:org:josso:simple:secdomainmatcher"
       xmlns:vhost-sdmatcher="urn:org:josso:vhost:secdomainmatcher"
       xmlns:appcxt-sdmatcher="urn:org:josso:appctx:secdomainmatcher"
       xmlns:def-auth="urn:org:josso:default:authenticator"
       xmlns:basic-authscheme="urn:org:josso:basic:authscheme"
       xmlns:bind-authscheme="urn:org:josso:bind:authscheme"
       xmlns:ntlm-authscheme="urn:org:josso:ntlm:authscheme"
       xmlns:strong-authscheme="urn:org:josso:strong:authscheme"
       xmlns:memory-istore="urn:org:josso:memory:identitystore"
       xmlns:def-identitymgr="urn:org:josso:default:identitymgr"
       xmlns:def-identityprv="urn:org:josso:default:identityprovider"
       xmlns:def-sessionmgr="urn:org:josso:default:sessionmgr"
       xmlns:memory-sstore="urn:org:josso:memory:sessionstore"
       xmlns:def-sidgen="urn:org:josso:default:sessionidgen"
       xmlns:def-assertionmgr="urn:org:josso:default:assertionmgr"
       xmlns:memory-astore="urn:org:josso:memory:assertionstore"
       xmlns:def-aidgen="urn:org:josso:default:assertionidgen"
       xmlns:def-auditmgr="urn:org:josso:default:auditmgr"
       xmlns:logger-atrailhandler="urn:org:josso:logger:audittrailhandler"
       xmlns:def-eventmgr="urn:org:josso:default:eventmgr"
       xmlns:def-pwdmgr="urn:org:josso:default:passwordmgr"
       xmlns:def-pwdgen="urn:org:josso:default:passwordgenerator"
       xmlns:email-pwddist="urn:org:josso:email:passworddistributor"
       xmlns:simple-lostpwd="urn:org:josso:simple:lostpasswordprocess"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        urn:org:josso:core http://www.josso.org/schema/josso-core.xsd
        urn:org:josso:default:secdomainselector http://www.josso.org/schema/josso-default-secdomainselector.xsd
        urn:org:josso:default:secdomainregistry http://www.josso.org/schema/josso-default-secdomainregistry.xsd
        urn:org:josso:simple:secdomainmatcher  http://www.josso.org/schema/josso-simple-secdomainmatcher.xsd
        urn:org:josso:vhost:secdomainmatcher http://www.josso.org/schema/josso-vhost-secdomainmatcher.xsd
        urn:org:josso:appctx:secdomainmatcher http://www.josso.org/schema/josso-appctx-secdomainmatcher.xsd
        urn:org:josso:default:authenticator http://www.josso.org/schema/josso-default-authenticator.xsd
        urn:org:josso:basic:authscheme http://www.josso.org/schema/josso-basic-authscheme.xsd
        urn:org:josso:bind:authscheme http://www.josso.org/schema/josso-bind-authscheme.xsd
        urn:org:josso:ntlm:authscheme http://www.josso.org/schema/josso-ntlm-authscheme.xsd
        urn:org:josso:strong:authscheme http://www.josso.org/schema/josso-strong-authscheme.xsd
        urn:org:josso:memory:identitystore http://www.josso.org/schema/josso-memory-identitystore.xsd
        urn:org:josso:default:identitymgr http://www.josso.org/schema/josso-default-identitymgr.xsd
        urn:org:josso:default:identityprovider http://www.josso.org/schema/josso-default-identityprovider.xsd
        urn:org:josso:default:sessionmgr http://www.josso.org/schema/josso-default-sessionmgr.xsd
        urn:org:josso:memory:sessionstore http://www.josso.org/schema/josso-memory-sessionstore.xsd
        urn:org:josso:default:sessionidgen http://www.josso.org/schema/josso-default-sessionidgen.xsd
        urn:org:josso:default:assertionmgr http://www.josso.org/schema/josso-default-assertionmgr.xsd
        urn:org:josso:memory:assertionstore http://www.josso.org/schema/josso-memory-assertionstore.xsd
        urn:org:josso:default:assertionidgen http://www.josso.org/schema/josso-default-assertionidgen.xsd
        urn:org:josso:default:auditmgr http://www.josso.org/schema/josso-default-auditmgr.xsd
        urn:org:josso:logger:audittrailhandler http://www.josso.org/schema/josso-logger-audittrailhandler.xsd
        urn:org:josso:default:eventmgr http://www.josso.org/schema/josso-default-eventmgr.xsd
        urn:org:josso:default:passwordmgr http://www.josso.org/schema/josso-default-passwordmanager.xsd
        urn:org:josso:default:passwordgenerator http://www.josso.org/schema/josso-default-passwordgenerator.xsd
        urn:org:josso:email:passworddistributor http://www.josso.org/schema/josso-email-passworddistributor.xsd
        urn:org:josso:simple:lostpasswordprocess http://www.josso.org/schema/josso-simple-lostpasswordprocess.xsd">

    <!-- ================================================================== -->
    <!-- JOSSO Gateway Configuration using Spring + XBean                   -->
    <!--                                                                    -->
    <!-- since JOSSO 1.8                                                    -->
    <!-- ================================================================== -->

    <!-- To keep things organized when using multiple security domains, prepend the domain name
    to component ids,  in our case all componetes use the 'josso' prefix -->

    <!-- ================================================================== -->
    <!-- Some components are configured in different files to make          -->
    <!-- configuraiton easier                                               -->
    <!-- ================================================================== -->

    <!-- Authentication schemes configuration -->
    <s:import resource="josso-gateway-auth.xml"/>

    <!-- SSO Self services configuration -->
    <s:import resource="josso-gateway-selfservices.xml"/>

    <!-- Identity, Session and Assertion Stores configuration -->
    <!--  
    	Marker: GateIn customization
    <s:import resource="josso-gateway-stores.xml" />
    -->
    <s:import resource="josso-gateway-gatein-stores.xml" />

    <!-- Web configuration (login form, etc) -->
    <s:import resource="josso-gateway-web.xml" />

    <!-- JMX, used internally -->
    <s:import resource="josso-gateway-jmx.xml" />

    <!-- ================================================================== -->
    <!-- Here we define gateway core structure                              -->
    <!-- ================================================================== -->
    <gateway>

        <sso-domain-selector>
            <def-sdselector:default-domain-selector/>
        </sso-domain-selector>

        <sso-domains-registry>
            <def-sdregistry:default-domains-registry/>
        </sso-domains-registry>

        <!-- ===================================================================== -->
        <!-- SSO Security Domains, here we have only one domain configured : josso -->
        <!-- Most components are configured elsewhere and referenced here to make  -->
        <!-- configuration easier.                                                 -->
        <!--                                                                       -->
        <!-- Unless you have multimple security domains, you will not need to      -->
        <!-- change this part                                                      -->
        <!-- ===================================================================== -->
        <domains>
            <s:ref bean="josso"/>
        </domains>

    </gateway>


    <!-- JOSSO Default security domain -->
    <domain name="josso" type="web">

        <sso-web-configuration>
            <s:ref bean="josso-web-configuraiton"/>
        </sso-web-configuration>

        <matchers>
            <simple-sdmatcher:simple-matcher/>
        </matchers>

        <authenticator>
            <s:ref bean="josso-authenticator"/>
        </authenticator>

        <identity-manager>
            <s:ref bean="josso-identity-manager"/>
        </identity-manager>

        <session-manager>
            <s:ref bean="josso-session-manager"/>
        </session-manager>

        <assertion-manager>
            <s:ref bean="josso-assertion-manager"/>
        </assertion-manager>

        <identity-provider>
            <s:ref bean="josso-identity-provider"/>
        </identity-provider>

        <audit-manager>
            <s:ref bean="josso-audit-manager"/>
        </audit-manager>

        <event-manager>
            <s:ref bean="josso-event-manager"/>
        </event-manager>

        <!-- Only needed when using NTLM -->
        <protocol-manager>
            <s:ref bean="josso-protocol-manager"/>
        </protocol-manager>

        <!-- Only neede for self-services (lost password, etc). -->
        <password-manager>
            <s:ref bean="josso-password-manager"/>
        </password-manager>

    </domain>


    <!-- ===================================================================== -->
    <!-- SSO Authenticator, all authentication schemes must be configured here -->
    <!-- ===================================================================== -->
    <def-auth:authenticator id="josso-authenticator">
        <!--  
        <def-auth:schemes>
            <s:ref bean="josso-basic-authentication"/>
            <s:ref bean="josso-strong-authentication"/>
            <s:ref bean="josso-rememberme-authentication"/>            
        </def-auth:schemes>
        -->
        
        <!--  Marker: GateIn customization -->
        <def-auth:schemes>	    
	    	<s:ref bean="josso-bind-authentication"/>	    
        </def-auth:schemes>
    </def-auth:authenticator>

    <!-- ===================================================================== -->
    <!-- SSO Identity manager, referencing identity store                      -->
    <!-- ===================================================================== -->
    <def-identitymgr:identity-manager id="josso-identity-manager">

        <def-identitymgr:identityStore>
            <s:ref bean="josso-identity-store"/>
        </def-identitymgr:identityStore>

        <def-identitymgr:identityStoreKeyAdapter>
            <s:ref bean="josso-simple-key-adapter"/>
        </def-identitymgr:identityStoreKeyAdapter>

    </def-identitymgr:identity-manager>

    <!-- ===================================================================== -->
    <!-- SSO Identity provider                                                 -->
    <!-- ===================================================================== -->
    <def-identityprv:identity-provider id="josso-identity-provider"/>

    <!-- ===================================================================== -->
    <!-- SSO Session manager, referencing session store                        -->
    <!-- ===================================================================== -->
    <def-sessionmgr:session-manager id="josso-session-manager"
            maxInactiveInterval="30"
            maxSessionsPerUser="-1"
            invalidateExceedingSessions="false"
            sessionMonitorInterval="10000">

        <def-sessionmgr:session-id-generator>
            <def-sidgen:id-generator algorithm="MD5"/>
        </def-sessionmgr:session-id-generator>

        <def-sessionmgr:session-store>
            <s:ref bean="josso-session-store"/>
        </def-sessionmgr:session-store>

    </def-sessionmgr:session-manager>

    <!-- ===================================================================== -->
    <!-- SSO Assertion anager, referencing assertion store                     -->
    <!-- ===================================================================== -->
    <def-assertionmgr:assertion-manager id="josso-assertion-manager">

        <def-assertionmgr:assertion-id-generator>
            <def-aidgen:id-generator/>
        </def-assertionmgr:assertion-id-generator>

        <def-assertionmgr:assertion-store>
            <s:ref bean="josso-assertion-store"/>
        </def-assertionmgr:assertion-store>

    </def-assertionmgr:assertion-manager>

    <!-- ===================================================================== -->
    <!-- SSO Audit Manager with audit trail handlers                           -->
    <!-- ===================================================================== -->
    <def-auditmgr:audit-manager id="josso-audit-manager">

        <!-- Audit Trail Handlers list -->
        <def-auditmgr:handlers>
            <logger-atrailhandler:audittrail-logger category="org.josso.AUDIT"/>
        </def-auditmgr:handlers>

    </def-auditmgr:audit-manager>

    <!-- ===================================================================== -->
    <!-- SSO Protocol Manager with handlers                                    -->
    <!-- ===================================================================== -->
    <default-protocol-manager id="josso-protocol-manager">
        <!-- To enable NTLM, uncomment this :
        <handlers>
            <ntlm-authscheme:ntlm-protocol-handler/>
        </handlers>
        -->
    </default-protocol-manager>

    <!-- ===================================================================== -->
    <!-- SSO Event manager, based on spring jmx                                -->
    <!-- ===================================================================== -->
    <def-eventmgr:springjmx-event-manager id="josso-event-manager">
        <def-eventmgr:listeners>
            <s:ref bean="josso-audit-manager"/>
        </def-eventmgr:listeners>
    </def-eventmgr:springjmx-event-manager>

    <!-- ===================================================================== -->
    <!-- SSO Simple key addapter used in several components                    -->
    <!-- ===================================================================== -->
    <simple-key-adapter id="josso-simple-key-adapter"/>

    <!-- ===================================================================== -->
    <!-- SSO Certificate key adapter used for strong authentication            -->
    <!-- ===================================================================== -->
    <certificate-key-adapter id="josso-certificate-key-adapter"/>

    <!-- ===================================================================== -->
    <!-- Spring Mail Sender bean.  Configure mail delivery settings here       -->
    <!-- ===================================================================== -->
    <s:bean id="josso-spring-mailsender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <!-- Spring JavaMaileSender properties :
            protocol, host, port, username, password -->
        <s:property name="host" value="mail.mycompany.com"/>
    </s:bean>

</s:beans>
