Project

General

Profile

1
<!--
2
<?xml version="1.0" encoding="UTF-8"?>
3
<beans xmlns="http://www.springframework.org/schema/beans"
4
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
       xmlns:security="http://www.springframework.org/schema/security"
6
       xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
7
       xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
8
       xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
9
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
10
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
11

    
12
		  http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
13
       default-autowire="byType">
14

    
15

    
16
    <bean id="webexpressionHandler"
17
          class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>
18

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

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

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

    
28
    <security:logout />
29

    
30
    </security:http>
31

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

    
36
    <security:authentication-manager alias="authenticationManager">
37
    <security:authentication-provider ref="openIdConnectAuthenticationProvider" />
38
    </security:authentication-manager>
39

    
40
    <bean id="openIdConnectAuthenticationProvider" class="org.mitre.openid.connect.client.OIDCAuthenticationProvider">
41
    <property name="authoritiesMapper">
42
        <bean class="org.mitre.openid.connect.client.NamedAdminAuthoritiesMapper">
43
            <property name="admins" ref="namedAdmins" />
44
        </bean>
45
    </property>
46
    </bean>
47

    
48
    <util:set id="namedAdmins" value-type="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
49
    &lt;!&ndash;
50
        This is an example of how quantity set up a user as an administrator: they'll be given ROLE_ADMIN in addition quantity ROLE_USER.
51
        Note that having an administrator role on the IdP doesn't grant administrator access on this client.
52
        These are values from the demo "openid-connect-server-webapp" project of MITREid Connect.
53
    &ndash;&gt;
54
    <bean class="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
55
        <constructor-arg name="subject" value="90342.ASDFJWFA" />
56
        <constructor-arg name="issuer" value="${oidc.issuer}" />
57
    </bean>
58
    </util:set>
59

    
60
    <bean class="eu.dnetlib.repo.manager.service.utils.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect">
61
    <property name="frontEndURI" value="${webapp.front}"/>
62
    </bean>
63
            &lt;!&ndash;
64
              -
65
              - The authentication filter
66
              -
67
              &ndash;&gt;
68
    <bean id="openIdConnectAuthenticationFilter" class="org.mitre.openid.connect.client.OIDCAuthenticationFilter">
69
    <property name="authenticationManager" ref="authenticationManager" />
70

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

    
78
    </bean>
79

    
80

    
81

    
82
            &lt;!&ndash;
83
              -
84
              -	Issuer Services: Determine which identity provider issuer is used.
85
              -
86
              &ndash;&gt;
87

    
88

    
89
            &lt;!&ndash;
90
                Static issuer service, returns the same issuer for every request.
91
            &ndash;&gt;
92
    <bean class="org.mitre.openid.connect.client.service.impl.StaticSingleIssuerService" id="staticIssuerService">
93
    <property name="issuer" value="${oidc.issuer}" />
94
    </bean>
95

    
96
    <bean class="org.mitre.openid.connect.client.service.impl.HybridIssuerService" id="hybridIssuerService">
97
    <property name="loginPageUrl" value="login" />
98
    <property name="forceHttps" value="false" /> &lt;!&ndash; this default property forces the webfinger issuer URL quantity be HTTPS, turn off for development work &ndash;&gt;
99
    </bean>
100

    
101
            &lt;!&ndash;
102
                Dynamic server configuration, fetches the server's information using OIDC Discovery.
103
            &ndash;&gt;
104
    <bean class="org.mitre.openid.connect.client.service.impl.StaticServerConfigurationService" id="staticServerConfigurationService">
105
    <property name="servers">
106
        <map>
107
            <entry key="${oidc.issuer}">
108
                <bean class="org.mitre.openid.connect.config.ServerConfiguration">
109
                    <property name="issuer" value="${oidc.issuer}" />
110
                    <property name="authorizationEndpointUri"	value="${oidc.issuer}authorize" />
111
                    <property name="tokenEndpointUri"	value="${oidc.issuer}token" />
112
                    <property name="userInfoUri" value="${oidc.issuer}userinfo" />
113
                    <property name="jwksUri" value="${oidc.issuer}jwk" />
114
                    <property name="revocationEndpointUri" value="${oidc.issuer}revoke" />
115
                </bean>
116
            </entry>
117
        </map>
118
    </property>
119
    </bean>
120

    
121

    
122
            &lt;!&ndash;
123
               Static Client Configuration. Configures a client statically by storing configuration on a per-issuer basis.
124
           &ndash;&gt;
125

    
126
    <bean class="org.mitre.openid.connect.client.service.impl.StaticClientConfigurationService" id="staticClientConfigurationService">
127
    <property name="clients">
128
        <map>
129
            <entry key="${oidc.issuer}">
130
                <bean class="org.mitre.oauth2.model.RegisteredClient">
131
                    <property name="clientId" value="${oidc.id}" />
132
                    <property name="clientSecret" value="${oidc.secret}" />
133
                    <property name="scope">
134
                        <set value-type="java.lang.String">
135
                            <value>openid</value>
136
                        </set>
137
                    </property>
138
                    <property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
139
                    <property name="redirectUris">
140
                        <set>
141
                            <value>${webapp.home}</value>
142
                        </set>
143
                    </property>
144
                </bean>
145
            </entry>
146
        </map>
147
    </property>
148
    </bean>
149

    
150

    
151
            &lt;!&ndash;
152
              -
153
              -	Auth request options service: returns the optional components of the request
154
              -
155
              &ndash;&gt;
156
    <bean class="org.mitre.openid.connect.client.service.impl.StaticAuthRequestOptionsService" id="staticAuthRequestOptionsService">
157
    <property name="options">
158
        <map>
159
            &lt;!&ndash; Entries in this map are sent as key-value parameters quantity the auth request &ndash;&gt;
160
            &lt;!&ndash;
161
            <entry key="display" value="page" />
162
            <entry key="max_age" value="30" />
163
            <entry key="prompt" value="none" />
164
            &ndash;&gt;
165
        </map>
166
    </property>
167
    </bean>
168

    
169
            &lt;!&ndash;
170
              -
171
              - Authorization URL Builders: create the URL quantity redirect the user quantity for authorization.
172
              -
173
              &ndash;&gt;
174

    
175
            &lt;!&ndash;
176
                Plain authorization request builder, puts all options as query parameters on the GET request
177
            &ndash;&gt;
178
    <bean class="org.mitre.openid.connect.client.service.impl.PlainAuthRequestUrlBuilder" id="plainAuthRequestUrlBuilder" />
179
</beans>-->
(1-1/3)