<?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:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">

    <bean id="acmRoleRedirectFilter" class="com.armedia.acm.auth.okta.auth.AcmRoleRedirectAuthenticationFilter">
        <property name="oktaConfig" ref="oktaConfig"/>
    </bean>

    <bean id="acmMultiFactorLoginSuccessHandler" class="com.armedia.acm.auth.okta.auth.AcmMultiFactorLoginSuccessHandler">
        <property name="oktaConfig" ref="oktaConfig"/>
        <property name="loginSuccessOperations" ref="acmLoginSuccessOperations"/>
        <property name="alwaysUseDefaultTargetUrl" value="true"/>
        <property name="sessionRegistry" ref="sessionRegistry"/>
        <property name="sessionAuthenticationStrategy" ref="concurrentSessionControlAuthenticationStrategy"/>
    </bean>

    <bean id="oktaRestService" class="com.armedia.acm.auth.okta.services.impl.OktaRestService">
        <property name="restTemplate" ref="restTemplate"/>
        <property name="oktaConfig" ref="oktaConfig"/>
    </bean>

    <bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
        <property name="errorHandler" ref="oktaRestTemplateErrorHandler"/>
    </bean>

    <bean id="oktaRestTemplateErrorHandler" class="com.armedia.acm.auth.okta.services.impl.OktaErrorHandler"/>

    <bean id="oktaFactorService" class="com.armedia.acm.auth.okta.services.impl.FactorServiceImpl">
        <property name="oktaRestService" ref="oktaRestService"/>
    </bean>

    <bean id="oktaFactorLifecycleService" class="com.armedia.acm.auth.okta.services.impl.FactorLifecycleServiceImpl">
        <property name="oktaRestService" ref="oktaRestService"/>
        <property name="factorService" ref="oktaFactorService"/>
    </bean>

    <bean id="oktaUserService" class="com.armedia.acm.auth.okta.services.impl.OktaUserServiceImpl">
        <property name="oktaRestService" ref="oktaRestService"/>
    </bean>

    <bean id="factorVerificationService" class="com.armedia.acm.auth.okta.services.impl.FactorVerificationServiceImpl">
        <property name="oktaRestService" ref="oktaRestService"/>
    </bean>

    <bean id="oktaConfig" class="com.armedia.acm.auth.okta.model.OktaConfig" scope="refresh">
        <aop:scoped-proxy/>
    </bean>
</beans>