1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4
|
xmlns:context="http://www.springframework.org/schema/context"
|
5
|
xmlns:tx="http://www.springframework.org/schema/tx"
|
6
|
xmlns:security="http://www.springframework.org/schema/security"
|
7
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
8
|
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
9
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
|
10
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
|
11
|
http://www.springframework.org/schema/security
|
12
|
http://www.springframework.org/schema/security/spring-security-3.0.4.xsd">
|
13
|
|
14
|
<!--
|
15
|
|
16
|
************************************************************************
|
17
|
* *
|
18
|
* DETLETE this file, only kept as reference, replaced by *
|
19
|
* *-securityTest.xml *
|
20
|
* *
|
21
|
************************************************************************
|
22
|
-->
|
23
|
|
24
|
<!-- <import resource="classpath:/eu/etaxonomy/cdm/defaultSecurityContext.xml"/> -->
|
25
|
|
26
|
<!--<import resource="classpath:/eu/etaxonomy/cdm/persistence.xml"/> -->
|
27
|
|
28
|
<context:component-scan base-package="eu/etaxonomy/cdm/persistence_security">
|
29
|
<context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.persistence\.dao\.hibernate\.taxon\.TaxonAlternativeSpellingSuggestionParser"/>
|
30
|
</context:component-scan>
|
31
|
<context:component-scan base-package="eu/etaxonomy/cdm/database"/>
|
32
|
|
33
|
<!-- includes service beans e.g. in eu/etaxonomy/cdm/api -->
|
34
|
<context:component-scan base-package="eu/etaxonomy/cdm/api/service">
|
35
|
<!-- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.api\.service\.UserService"/> -->
|
36
|
</context:component-scan>
|
37
|
|
38
|
<context:component-scan base-package="eu/etaxonomy/cdm/api/application"/>
|
39
|
|
40
|
<!-- enable the configuration of transactional behavior based on annotations -->
|
41
|
<tx:annotation-driven transaction-manager="transactionManager"/>
|
42
|
|
43
|
<bean id="transactionManager"
|
44
|
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
|
45
|
<property name="sessionFactory" ref="sessionFactory"/>
|
46
|
</bean>
|
47
|
|
48
|
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
|
49
|
<property name="namingStrategy">
|
50
|
<bean class="org.hibernate.cfg.DefaultComponentSafeNamingStrategy" />
|
51
|
</property>
|
52
|
|
53
|
<property name="configLocation" value="classpath:eu/etaxonomy/cdm/hibernate.cfg.xml"/>
|
54
|
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/>
|
55
|
<property name="dataSource" ref="dataSource"/>
|
56
|
<property name="hibernateProperties" ref="hibernateProperties"/>
|
57
|
</bean>
|
58
|
|
59
|
|
60
|
<bean id="dataSource" class="org.unitils.database.UnitilsDataSourceFactoryBean"/>
|
61
|
|
62
|
<bean id="hibernateProperties"
|
63
|
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
64
|
<property name="properties">
|
65
|
<props>
|
66
|
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLCorrectedDialect</prop>
|
67
|
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.internal.NoCachingRegionFactory</prop>
|
68
|
<!-- TODO trying to use a managed session context -->
|
69
|
<!-- <prop key="hibernate.current_session_context_class">managed</prop>-->
|
70
|
<prop key="hibernate.show_sql">false</prop>
|
71
|
<prop key="hibernate.format_sql">false</prop>
|
72
|
<prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.impl.FSDirectoryProvider</prop>
|
73
|
<prop key="hibernate.search.default.indexBase">./target/test-classes</prop>
|
74
|
</props>
|
75
|
</property>
|
76
|
</bean>
|
77
|
|
78
|
<bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
|
79
|
<property name="providers">
|
80
|
<list>
|
81
|
<bean class="org.springframework.security.authentication.TestingAuthenticationProvider"/>
|
82
|
<ref local="daoAuthenticationProvider"/>
|
83
|
</list>
|
84
|
</property>
|
85
|
</bean>
|
86
|
|
87
|
<bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
|
88
|
<property name="userDetailsService" ref="userService"/>
|
89
|
<property name="saltSource" ref="saltSource"/>
|
90
|
<property name="passwordEncoder" ref="passwordEncoder"/>
|
91
|
</bean>
|
92
|
|
93
|
<bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder"/>
|
94
|
|
95
|
<bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource">
|
96
|
<property name="userPropertyToUse" value="getUsername"/>
|
97
|
</bean>
|
98
|
|
99
|
<security:global-method-security pre-post-annotations="enabled">
|
100
|
<security:expression-handler ref="expressionHandler"/>
|
101
|
</security:global-method-security>
|
102
|
|
103
|
<bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
|
104
|
<property name="permissionEvaluator" ref="cdmPermissionEvaluator"/>
|
105
|
</bean>
|
106
|
|
107
|
|
108
|
<bean class="eu.etaxonomy.cdm.permission.CdmPermissionEvaluator" id="cdmPermissionEvaluator"/>
|
109
|
|
110
|
<bean id="userService" class="eu.etaxonomy.cdm.api.service.UserService">
|
111
|
|
112
|
</bean>
|
113
|
|
114
|
|
115
|
<bean id="groupService" class="eu.etaxonomy.cdm.api.service.GroupServiceImpl">
|
116
|
|
117
|
</bean>
|
118
|
|
119
|
|
120
|
<bean id="titleAndNameCacheAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.TitleAndNameCacheAutoInitializer"></bean>
|
121
|
|
122
|
<bean id="defaultBeanInitializer" class="eu.etaxonomy.cdm.persistence.dao.hibernate.HibernateBeanInitializer">
|
123
|
<property name="beanAutoInitializers">
|
124
|
<map>
|
125
|
<entry key="eu.etaxonomy.cdm.model.common.IdentifiableEntity" value-ref="titleAndNameCacheAutoInitializer" />
|
126
|
</map>
|
127
|
</property>
|
128
|
</bean>
|
129
|
</beans>
|