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 http://www.springframework.org/schema/security/spring-security-3.2.xsd
|
6
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
|
7
|
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd"
|
8
|
default-autowire="byType">
|
9
|
|
10
|
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
11
|
<property name="maxUploadSize" value="268435456"/>
|
12
|
</bean>
|
13
|
|
14
|
<bean id="webexpressionHandler"
|
15
|
class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>
|
16
|
|
17
|
<security:global-method-security pre-post-annotations="enabled" proxy-target-class="true" authentication-manager-ref="authenticationManager"/>
|
18
|
|
19
|
<security:http auto-config="false" use-expressions="true"
|
20
|
disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint"
|
21
|
pattern="/**">
|
22
|
|
23
|
<security:custom-filter before="PRE_AUTH_FILTER" ref="openIdConnectAuthenticationFilter" />
|
24
|
|
25
|
<security:logout />
|
26
|
|
27
|
</security:http>
|
28
|
|
29
|
<bean id="authenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint" >
|
30
|
<constructor-arg type="java.lang.String" value="/openid_connect_login"/>
|
31
|
</bean>
|
32
|
|
33
|
<security:authentication-manager alias="authenticationManager">
|
34
|
<security:authentication-provider ref="openIdConnectAuthenticationProvider" />
|
35
|
</security:authentication-manager>
|
36
|
|
37
|
<bean id="openIdConnectAuthenticationProvider" class="org.mitre.openid.connect.client.OIDCAuthenticationProvider">
|
38
|
<property name="authoritiesMapper">
|
39
|
<bean class="eu.dnetlib.repo.manager.service.config.OpenAireProviderAuthoritiesMapper">
|
40
|
<constructor-arg name="userRoles" ref="userRoles"/>
|
41
|
</bean>
|
42
|
</property>
|
43
|
</bean>
|
44
|
|
45
|
<util:map id="userRoles">
|
46
|
<entry key="urn:geant:openaire.eu:group:Super+Administrator" value="ROLE_ADMIN"/>
|
47
|
</util:map>
|
48
|
|
49
|
|
50
|
<bean class="eu.dnetlib.repo.manager.service.config.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect">
|
51
|
<property name="frontEndURI" value="${webapp.dev.front}"/>
|
52
|
</bean>
|
53
|
|
54
|
<!--
|
55
|
-
|
56
|
- The authentication filter
|
57
|
-
|
58
|
-->
|
59
|
<bean id="openIdConnectAuthenticationFilter" class="org.mitre.openid.connect.client.OIDCAuthenticationFilter">
|
60
|
<property name="authenticationManager" ref="authenticationManager" />
|
61
|
|
62
|
<property name="issuerService" ref="staticIssuerService" />
|
63
|
<property name="serverConfigurationService" ref="staticServerConfigurationService" />
|
64
|
<property name="clientConfigurationService" ref="staticClientConfigurationService" />
|
65
|
<property name="authRequestOptionsService" ref="staticAuthRequestOptionsService" />
|
66
|
<property name="authRequestUrlBuilder" ref="plainAuthRequestUrlBuilder" />
|
67
|
<property name="authenticationSuccessHandler" ref="frontEndRedirect"/>
|
68
|
|
69
|
</bean>
|
70
|
|
71
|
<!--
|
72
|
Static issuer service, returns the same issuer for every request.
|
73
|
-->
|
74
|
<bean class="org.mitre.openid.connect.client.service.impl.StaticSingleIssuerService" id="staticIssuerService">
|
75
|
<property name="issuer" value="${oidc.issuer}" />
|
76
|
</bean>
|
77
|
|
78
|
<!--
|
79
|
Dynamic server configuration, fetches the server's information using OIDC Discovery.
|
80
|
-->
|
81
|
<bean class="org.mitre.openid.connect.client.service.impl.StaticServerConfigurationService" id="staticServerConfigurationService">
|
82
|
<property name="servers">
|
83
|
<map>
|
84
|
<entry key="${oidc.issuer}">
|
85
|
<bean class="org.mitre.openid.connect.config.ServerConfiguration">
|
86
|
<property name="issuer" value="${oidc.issuer}" />
|
87
|
<property name="authorizationEndpointUri" value="${oidc.issuer}authorize" />
|
88
|
<property name="tokenEndpointUri" value="${oidc.issuer}token" />
|
89
|
<property name="userInfoUri" value="${oidc.issuer}userinfo" />
|
90
|
<property name="jwksUri" value="${oidc.issuer}jwk" />
|
91
|
<property name="revocationEndpointUri" value="${oidc.issuer}revoke" />
|
92
|
</bean>
|
93
|
</entry>
|
94
|
</map>
|
95
|
</property>
|
96
|
</bean>
|
97
|
|
98
|
|
99
|
<!--
|
100
|
Static Client Configuration. Configures a client statically by storing configuration on a per-issuer basis.
|
101
|
-->
|
102
|
<bean class="org.mitre.openid.connect.client.service.impl.StaticClientConfigurationService" id="staticClientConfigurationService">
|
103
|
<property name="clients">
|
104
|
<map>
|
105
|
<entry key="${oidc.issuer}">
|
106
|
<bean class="org.mitre.oauth2.model.RegisteredClient">
|
107
|
<property name="clientId" value="${oidc.id}" />
|
108
|
<property name="clientSecret" value="${oidc.secret}" />
|
109
|
<property name="scope">
|
110
|
<set value-type="java.lang.String">
|
111
|
<value>openid</value>
|
112
|
</set>
|
113
|
</property>
|
114
|
<property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
|
115
|
<property name="redirectUris">
|
116
|
<set>
|
117
|
<value>${oidc.dev.home}</value>
|
118
|
</set>
|
119
|
</property>
|
120
|
</bean>
|
121
|
</entry>
|
122
|
</map>
|
123
|
</property>
|
124
|
</bean>
|
125
|
|
126
|
|
127
|
<!--
|
128
|
-
|
129
|
- Auth request options service: returns the optional components of the request
|
130
|
-
|
131
|
-->
|
132
|
<bean class="org.mitre.openid.connect.client.service.impl.StaticAuthRequestOptionsService" id="staticAuthRequestOptionsService">
|
133
|
<property name="options">
|
134
|
<map>
|
135
|
<!-- Entries in this map are sent as key-value parameters to the auth request -->
|
136
|
<!--
|
137
|
<entry key="display" value="page" />
|
138
|
<entry key="max_age" value="30" />
|
139
|
<entry key="prompt" value="none" />
|
140
|
-->
|
141
|
</map>
|
142
|
</property>
|
143
|
</bean>
|
144
|
|
145
|
<!--
|
146
|
Plain authorization request builder, puts all options as query parameters on the GET request
|
147
|
-->
|
148
|
<bean class="org.mitre.openid.connect.client.service.impl.PlainAuthRequestUrlBuilder" id="plainAuthRequestUrlBuilder" />
|
149
|
</beans>
|