Project

General

Profile

« Previous | Next » 

Revision 0ee1155e

Added by Andreas Kohlbecker over 11 years ago

cleaning up spring context configuration

View differences:

cdmlib-services/src/main/resources/eu/etaxonomy/cdm/services_security.xml
2 2
<beans xmlns="http://www.springframework.org/schema/beans"
3 3
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 4
  xmlns:context="http://www.springframework.org/schema/context"
5
  xsi:schemaLocation="http://www.springframework.org/schema/beans
6
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
7
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
5
  xmlns:security="http://www.springframework.org/schema/security"
6
  xsi:schemaLocation="
7
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
8
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
9
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
10
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.4.xsd"
8 11
    >
9 12

  
10 13
    <import resource="classpath:/eu/etaxonomy/cdm/persistence_security.xml"/>
11 14

  
15
    <!--
16
        ======================================================================
17
          default service configuration (same as in services.xml)
18
        ======================================================================
19
     -->
12 20
    <context:component-scan base-package="eu/etaxonomy/cdm/persistence">
13 21
      <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.persistence\.dao\.hibernate\.taxon\.TaxonAlternativeSpellingSuggestionParser"/>
14 22
    </context:component-scan>
......
17 25

  
18 26
    <context:component-scan base-package="eu/etaxonomy/cdm/database"/>
19 27

  
20
    <!-- also find the implementation of ITaxonNodeComparator -->
21
    <!--context:component-scan base-package="eu/etaxonomy/cdm/model/taxon"/-->
28
    <!-- also find the implementation of ITaxonNodeComparator (otherwise it is not found by a component scan)  -->
22 29
    <bean name="taxonNodeByNameComparator" class="eu.etaxonomy.cdm.model.taxon.TaxonNodeByNameComparator">
23 30
    </bean>
31

  
32
    <!--
33
        ======================================================================
34
          security specific configuration
35
        ======================================================================
36
     -->
37
    <security:global-method-security pre-post-annotations="enabled">
38
        <security:expression-handler ref="expressionHandler" />
39
    </security:global-method-security>
40

  
41
    <!--
42
        To use "hasPermission()" in the Spring EL method annotations like @PreAuthorize we explicitly configure the permissionEvaluator
43
        the cdmPermissionEvaluator is already defined in the persistence security context
44
    -->
45
    <bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
46
        <property name="permissionEvaluator" ref="cdmPermissionEvaluator" />
47
    </bean>
48

  
49
    <bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
50
        <property name="providers">
51
            <list>
52
                <ref local="daoAuthenticationProvider"/>
53
            </list>
54
        </property>
55
    </bean>
56

  
57
    <bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
58
        <property name="userDetailsService" ref="userService"/>
59
        <property name="saltSource" ref="saltSource"/>
60
        <property name="passwordEncoder" ref="passwordEncoder"/>
61
    </bean>
62

  
63
    <bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder"/>
64

  
65
    <bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource">
66
        <property name="userPropertyToUse" value="getUsername"/>
67
    </bean>
68

  
24 69
</beans>

Also available in: Unified diff