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

	<bean id="shutdownUtils" class="eu.dnetlib.functionality.modular.ui.utils.ShutdownUtils"/>

	<bean id="simpleSSOAuthorizationManager" 
		class="eu.dnetlib.functionality.modular.ui.users.SimpleSSOAuthorizationManager" 
		init-method="init"
		p:pubKeyAlgo="${dnet.modular.ui.auth.pubkey.algo}" 
		p:pubKeyFile="${dnet.modular.ui.auth.pubkey.derFile}" 
		p:signatureAlgo="${dnet.modular.ui.auth.signature.algo}" 
		p:authorizationDAO-ref="modularUiAuthorizationDao" 
		p:defaultSuperAdmin="${dnet.modular.ui.authorization.default.superAdmin}"/>


	<bean id="modularUiMongoServer" class="com.mongodb.Mongo">
		<constructor-arg index="0" type="com.mongodb.ServerAddress">
			<bean class="com.mongodb.ServerAddress">
				<constructor-arg index="0" value="${dnet.modular.ui.authorization.mongo.host}" />
				<constructor-arg index="1" value="${dnet.modular.ui.authorization.mongo.port}" />
			</bean>
		</constructor-arg>
	</bean>

	<bean id="mongoAuthorizationDao" 
		class="eu.dnetlib.functionality.modular.ui.users.MongoAuthorizationDAO">
		<property name="db">
			<bean factory-bean="modularUiMongoServer" factory-method="getDB">
				<constructor-arg index="0" value="${dnet.modular.ui.authorization.mongo.db}" />
			</bean>
		</property>
	</bean> 
	
	<bean id="mockUserAuthenticationManager" class="eu.dnetlib.functionality.modular.ui.users.MockAuthorizationManager" />

	<bean id="simpleAuthenticationManager" class="eu.dnetlib.functionality.modular.ui.users.SimpleAuthorizationManager" 
		p:authorizationDAO-ref="modularUiAuthorizationDao"
		p:defaultSuperAdmin="${dnet.modular.ui.authorization.default.superAdmin}"/>	

	<alias name="${dnet.modular.ui.authorization.manager}" alias="modularUiAuthorizationManager"/>
	<alias name="${dnet.modular.ui.authorization.dao}" alias="modularUiAuthorizationDao"/>

</beans>
