Project

General

Profile

1
<beans xmlns="http://www.springframework.org/schema/beans"
2
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
       xmlns:security="http://www.springframework.org/schema/security"
4
       xmlns:util="http://www.springframework.org/schema/util"
5
       xsi:schemaLocation="http://www.springframework.org/schema/security
6
       http://www.springframework.org/schema/security/spring-security-3.2.xsd
7
		http://www.springframework.org/schema/beans
8
		http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
9
		http://www.springframework.org/schema/util
10
		http://www.springframework.org/schema/util/spring-util-4.1.xsd"
11
       default-autowire="byType">
12

    
13

    
14
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
15
        <property name="maxUploadSize" value="268435456"/>
16
    </bean>
17

    
18
    <!--<bean id="webexpressionHandler"
19
          class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>-->
20

    
21
    <security:global-method-security pre-post-annotations="enabled" proxy-target-class="true" authentication-manager-ref="authenticationManager"/>
22

    
23
    <security:http auto-config="false" use-expressions="true"
24
                   disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint"
25
                   pattern="/**">
26

    
27
        <security:custom-filter before="PRE_AUTH_FILTER" ref="openIdConnectAuthenticationFilter" />
28

    
29
        <security:logout logout-url="/openid_logout" invalidate-session="true"
30
                         delete-cookies="openAIRESession" logout-success-url="${webapp.dev.front}"/>
31

    
32
    </security:http>
33

    
34

    
35
    <bean id="authenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint" >
36
        <constructor-arg type="java.lang.String" value="/openid_connect_login"/>
37
    </bean>
38

    
39
    <security:authentication-manager alias="authenticationManager">
40
        <security:authentication-provider ref="openIdConnectAuthenticationProvider" />
41
    </security:authentication-manager>
42

    
43
    <bean id="openIdConnectAuthenticationProvider" class="org.mitre.openid.connect.client.OIDCAuthenticationProvider">
44
        <property name="authoritiesMapper">
45
            <bean class="eu.dnetlib.repo.manager.service.config.OpenAireProviderAuthoritiesMapper">
46
                <constructor-arg name="userRoles" ref="userRoles"/>
47
            </bean>
48
        </property>
49
    </bean>
50

    
51
    <util:map id="userRoles">
52
        <entry key="urn:geant:openaire.eu:group:Super+Administrator#aai.openaire.eu" value="ROLE_ADMIN"/>
53
    </util:map>
54

    
55

    
56
    <bean class="eu.dnetlib.repo.manager.service.config.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect"
57
          init-method="init">
58
        <property name="frontEndURI" value="${webapp.dev.front}"/>
59
    </bean>
60

    
61
    <!--
62
      -
63
      - The authentication filter
64
      -
65
      -->
66
    <bean id="openIdConnectAuthenticationFilter" class="org.mitre.openid.connect.client.OIDCAuthenticationFilter">
67
        <property name="authenticationManager" ref="authenticationManager" />
68

    
69
        <property name="issuerService" ref="staticIssuerService" />
70
        <property name="serverConfigurationService" ref="staticServerConfigurationService" />
71
        <property name="clientConfigurationService" ref="staticClientConfigurationService" />
72
        <property name="authRequestOptionsService" ref="staticAuthRequestOptionsService" />
73
        <property name="authRequestUrlBuilder" ref="plainAuthRequestUrlBuilder" />
74
        <property name="authenticationSuccessHandler" ref="frontEndRedirect"/>
75

    
76
    </bean>
77

    
78
    <!--
79
        Static issuer service, returns the same issuer for every request.
80
    -->
81
    <bean class="org.mitre.openid.connect.client.service.impl.StaticSingleIssuerService" id="staticIssuerService">
82
        <property name="issuer" value="${oidc.issuer}" />
83
    </bean>
84

    
85
    <!--
86
        Dynamic server configuration, fetches the server's information using OIDC Discovery.
87
    -->
88
    <bean class="org.mitre.openid.connect.client.service.impl.StaticServerConfigurationService" id="staticServerConfigurationService">
89
        <property name="servers">
90
            <map>
91
                <entry key="${oidc.issuer}">
92
                    <bean class="org.mitre.openid.connect.config.ServerConfiguration">
93
                        <property name="issuer" value="${oidc.issuer}" />
94
                        <property name="authorizationEndpointUri"	value="${oidc.issuer}authorize" />
95
                        <property name="tokenEndpointUri"	value="${oidc.issuer}token" />
96
                        <property name="userInfoUri" value="${oidc.issuer}userinfo" />
97
                        <property name="jwksUri" value="${oidc.issuer}jwk" />
98
                        <property name="revocationEndpointUri" value="${oidc.issuer}revoke" />
99
                    </bean>
100
                </entry>
101
            </map>
102
        </property>
103
    </bean>
104

    
105

    
106
    <!--
107
       Static Client Configuration. Configures a client statically by storing configuration on a per-issuer basis.
108
    -->
109
    <bean class="org.mitre.openid.connect.client.service.impl.StaticClientConfigurationService" id="staticClientConfigurationService">
110
        <property name="clients">
111
            <map>
112
                <entry key="${oidc.issuer}">
113
                    <bean class="org.mitre.oauth2.model.RegisteredClient">
114
                        <property name="clientId" value="${oidc.id}" />
115
                        <property name="clientSecret" value="${oidc.secret}" />
116
                        <property name="scope">
117
                            <set value-type="java.lang.String">
118
                                <value>openid</value>
119
                            </set>
120
                        </property>
121
                        <property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
122
                        <property name="redirectUris">
123
                            <set>
124
                                <value>${oidc.dev.home}</value>
125
                            </set>
126
                        </property>
127
                    </bean>
128
                </entry>
129
            </map>
130
        </property>
131
    </bean>
132

    
133

    
134
    <!--
135
      -
136
      -	Auth request options service: returns the optional components of the request
137
      -
138
      -->
139
    <bean class="org.mitre.openid.connect.client.service.impl.StaticAuthRequestOptionsService" id="staticAuthRequestOptionsService">
140
        <property name="options">
141
            <map>
142
                <!-- Entries in this map are sent as key-value parameters to the auth request -->
143
                <!--
144
                <entry key="display" value="page" />
145
                <entry key="max_age" value="30" />
146
                <entry key="prompt" value="none" />
147
                -->
148
            </map>
149
        </property>
150
    </bean>
151

    
152
    <!--
153
        Plain authorization request builder, puts all options as query parameters on the GET request
154
    -->
155
    <bean class="org.mitre.openid.connect.client.service.impl.PlainAuthRequestUrlBuilder" id="plainAuthRequestUrlBuilder" />
156
</beans>
(1-1/5)