Project

General

Profile

« Previous | Next » 

Revision 50288

1. COnfiguration for aai

View differences:

modules/uoa-repository-manager-gui/branches/aai/src/main/java/eu/dnetlib/repo/manager/client/LoginPage.java
26 26
import org.gwtbootstrap3.client.ui.constants.AlertType;
27 27
import org.gwtbootstrap3.client.ui.constants.ButtonType;
28 28
import org.gwtbootstrap3.client.ui.html.Paragraph;
29
import org.springframework.beans.factory.annotation.Value;
29 30

  
31
import java.io.IOException;
32
import java.net.HttpURLConnection;
33
import java.net.URL;
30 34
import java.util.Date;
31 35

  
36
import static org.springframework.http.HttpHeaders.USER_AGENT;
37

  
32 38
/**
33 39
 * Created by stefania on 12/2/15.
34 40
 */
......
52 58
    private UserServiceAsync userService = GWT.create(UserService.class);
53 59
    private LoginListener loginListener;
54 60

  
61
    @Value("${oidc.issuer}")
62
    private String oidcURL;
63

  
55 64
    private LoginPage() {
56 65

  
57 66
        successLabel.setType(AlertType.SUCCESS);
modules/uoa-repository-manager-gui/branches/aai/src/main/resources/eu/dnetlib/repo/manager/server/config/springContext-repo-manager.xml
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<beans xmlns="http://www.springframework.org/schema/beans"
3
       xmlns:util="http://www.springframework.org/schema/util"
3 4
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
       xmlns:t="http://dnetlib.eu/springbeans/t"
5
       xmlns:tx="http://www.springframework.org/schema/tx"
6 5
       xmlns:task="http://www.springframework.org/schema/task"
7
       xmlns:aop="http://www.springframework.org/schema/aop"
8
       xmlns:context="http://www.springframework.org/schema/context"
9

  
6
       xmlns:security="http://www.springframework.org/schema/security"
10 7
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
11
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
12 8
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
13
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
9
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"
10
       default-autowire="byType">
14 11

  
15 12
    <task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
16 13
    <task:executor id="myExecutor" pool-size="5"/>
......
28 25
        <property name="debug" value="${services.validator.mail.debug}"/>
29 26
    </bean>
30 27

  
31
    <!--<bean id="validationService" class="eu.dnetlib.repo.manager.server.services.ValidationServiceImpl">
32
        <property name="validatorServiceLocator" ref="validatorServiceLocator"/>
28
    <security:global-method-security pre-post-annotations="enabled" proxy-target-class="true" authentication-manager-ref="authenticationManager"/>
29

  
30
    <security:http auto-config="false" use-expressions="true"
31
                   disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint"
32
                   pattern="/**">
33

  
34
        <security:custom-filter before="PRE_AUTH_FILTER" ref="openIdConnectAuthenticationFilter" />
35

  
36
        <security:logout />
37

  
38
    </security:http>
39

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

  
35
    <bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
36
        <property name="driverClassName" value="${repomanager.db.driverClassName}" />
37
        <property name="url" value="${repomanager.db.url}" />
38
        <property name="username" value="${repomanager.db.username}" />
39
        <property name="password" value="${repomanager.db.password}" />
40
        <property name="maxIdle" value="10" />
41
        <property name="maxActive" value="100" />
42
        <property name="maxWait" value="10000" />
43
        <property name="validationQuery" value="SELECT 1;" />
44
        <property name="testOnBorrow" value="true" />
45
        <property name="testOnReturn" value="true" />
46
        <property name="testWhileIdle" value="true" />
47
        <property name="timeBetweenEvictionRunsMillis" value="1200000" />
48
        <property name="minEvictableIdleTimeMillis" value="1800000" />
49
        <property name="numTestsPerEvictionRun" value="5" />
50
        <property name="poolPreparedStatements" value="true" />
51
        <property name="defaultAutoCommit" value="true" />
44
    <security:authentication-manager alias="authenticationManager">
45
        <security:authentication-provider ref="openIdConnectAuthenticationProvider" />
46
    </security:authentication-manager>
47

  
48
    <bean id="openIdConnectAuthenticationProvider" class="org.mitre.openid.connect.client.OIDCAuthenticationProvider">
49
        <property name="authoritiesMapper">
50
            <bean class="org.mitre.openid.connect.client.NamedAdminAuthoritiesMapper">
51
                <property name="admins" ref="namedAdmins" />
52
            </bean>
53
        </property>
52 54
    </bean>
53 55

  
54
    <aop:aspectj-autoproxy proxy-target-class="true" />
55
    <tx:annotation-driven transaction-manager="txManager"/>
56
    <util:set id="namedAdmins" value-type="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
57
        <!--
58
            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.
59
            Note that having an administrator role on the IdP doesn't grant administrator access on this client.
60
            These are values from the demo "openid-connect-server-webapp" project of MITREid Connect.
61
        -->
62
        <bean class="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
63
            <constructor-arg name="subject" value="90342.ASDFJWFA" />
64
            <constructor-arg name="issuer" value="${oidc.issuer}" />
65
        </bean>
66
    </util:set>
56 67

  
57
    <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
58
        <property name="dataSource" ref="repomanager.dataSource"/>
59
    </bean>-->
68

  
69
    <bean class="eu.openminted.registry.beans.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect">
70
        <property name="frontEndURI" value="${webapp.front}"/>
71
    </bean>
72
    <!--
73
      -
74
      - The authentication filter
75
      -
76
      -->
77
    <bean id="openIdConnectAuthenticationFilter" class="org.mitre.openid.connect.client.OIDCAuthenticationFilter">
78
        <property name="authenticationManager" ref="authenticationManager" />
79

  
80
        <property name="issuerService" ref="staticIssuerService" />
81
        <property name="serverConfigurationService" ref="staticServerConfigurationService" />
82
        <property name="clientConfigurationService" ref="staticClientConfigurationService" />
83
        <property name="authRequestOptionsService" ref="staticAuthRequestOptionsService" />
84
        <property name="authRequestUrlBuilder" ref="plainAuthRequestUrlBuilder" />
85
        <property name="authenticationSuccessHandler" ref="frontEndRedirect"/>
86

  
87
    </bean>
88

  
89

  
90

  
91
    <!--
92
      -
93
      -	Issuer Services: Determine which identity provider issuer is used.
94
      -
95
      -->
96

  
97

  
98
    <!--
99
        Static issuer service, returns the same issuer for every request.
100
    -->
101
    <bean class="org.mitre.openid.connect.client.service.impl.StaticSingleIssuerService" id="staticIssuerService">
102
        <property name="issuer" value="${oidc.issuer}" />
103
    </bean>
104

  
105
    <bean class="org.mitre.openid.connect.client.service.impl.HybridIssuerService" id="hybridIssuerService">
106
        <property name="loginPageUrl" value="login" />
107
        <property name="forceHttps" value="false" /> <!-- this default property forces the webfinger issuer URL quantity be HTTPS, turn off for development work -->
108
    </bean>
109

  
110
    <!--
111
		Dynamic server configuration, fetches the server's information using OIDC Discovery.
112
	-->
113
    <bean class="org.mitre.openid.connect.client.service.impl.StaticServerConfigurationService" id="staticServerConfigurationService">
114
        <property name="servers">
115
            <map>
116
                <entry key="${oidc.issuer}">
117
                    <bean class="org.mitre.openid.connect.config.ServerConfiguration">
118
                        <property name="issuer" value="${oidc.issuer}" />
119
                        <property name="authorizationEndpointUri"	value="${oidc.issuer}authorize" />
120
                        <property name="tokenEndpointUri"	value="${oidc.issuer}token" />
121
                        <property name="userInfoUri" value="${oidc.issuer}userinfo" />
122
                        <property name="jwksUri" value="${oidc.issuer}jwk" />
123
                        <property name="revocationEndpointUri" value="${oidc.issuer}revoke" />
124
                    </bean>
125
                </entry>
126
            </map>
127
        </property>
128
    </bean>
129

  
130

  
131
    <!--
132
       Static Client Configuration. Configures a client statically by storing configuration on a per-issuer basis.
133
   -->
134

  
135
    <bean class="org.mitre.openid.connect.client.service.impl.StaticClientConfigurationService" id="staticClientConfigurationService">
136
        <property name="clients">
137
            <map>
138
                <entry key="${oidc.issuer}">
139
                    <bean class="org.mitre.oauth2.model.RegisteredClient">
140
                        <property name="clientId" value="${oidc.id}" />
141
                        <property name="clientSecret" value="${oidc.secret}" />
142
                        <property name="scope">
143
                            <set value-type="java.lang.String">
144
                                <value>openid</value>
145
                            </set>
146
                        </property>
147
                        <property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
148
                        <property name="redirectUris">
149
                            <set>
150
                                <value>${webapp.home}</value>
151
                            </set>
152
                        </property>
153
                    </bean>
154
                </entry>
155
            </map>
156
        </property>
157
    </bean>
158

  
159

  
160
    <!--
161
	  -
162
	  -	Auth request options service: returns the optional components of the request
163
	  -
164
	  -->
165
    <bean class="org.mitre.openid.connect.client.service.impl.StaticAuthRequestOptionsService" id="staticAuthRequestOptionsService">
166
        <property name="options">
167
            <map>
168
                <!-- Entries in this map are sent as key-value parameters quantity the auth request -->
169
                <!--
170
                <entry key="display" value="page" />
171
                <entry key="max_age" value="30" />
172
                <entry key="prompt" value="none" />
173
                -->
174
            </map>
175
        </property>
176
    </bean>
177

  
178
    <!--
179
	  -
180
	  - Authorization URL Builders: create the URL quantity redirect the user quantity for authorization.
181
	  -
182
	  -->
183

  
184
    <!--
185
        Plain authorization request builder, puts all options as query parameters on the GET request
186
    -->
187
    <bean class="org.mitre.openid.connect.client.service.impl.PlainAuthRequestUrlBuilder" id="plainAuthRequestUrlBuilder" />
60 188
</beans>
modules/uoa-repository-manager-gui/branches/aai/src/main/resources/eu/dnetlib/repo/manager/server/springContext-repo-manager.properties
56 56

  
57 57
services.repomanager.usageStatisticsDiagramsBaseURL = https://beta.openaire.eu/stats3/
58 58
services.repomanager.usageStatisticsNumbersBaseURL = https://beta.services.openaire.eu/usagestats/datasources/
59
services.repomanager.usagestats.adminEmail = repositoryusagestats@openaire.eu
59
services.repomanager.usagestats.adminEmail = repositoryusagestats@openaire.eu
60

  
61
oidc.issuer = https://aai.openminted.eu/oidc/
62
oidc.id = id
63
oidc.secret = secret
64
webapp.home = https://localhost:8380/uoa-repository-manager-gui/openid_connect_login
modules/uoa-repository-manager-gui/branches/aai/src/main/webapp/WEB-INF/applicationContext.xml
3 3
<beans xmlns="http://www.springframework.org/schema/beans"
4 4
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
5 5
       xmlns:context="http://www.springframework.org/schema/context"
6

  
6
       xmlns:security="http://www.springframework.org/schema/security"
7 7
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
8
	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
8
	    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
9
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"
10
       default-autowire="byType">
9 11

  
10 12

  
11 13

  
......
71 73
            </list>
72 74
        </property>
73 75
    </bean>
76

  
77

  
78
    <security:global-method-security pre-post-annotations="enabled" proxy-target-class="true"
79
                                     authentication-manager-ref="authenticationManager">
80
        <!--you could also wire in the expression handler up at the layer of the http filters. See https://jira.springsource.org/browse/SEC-1452 -->
81
    </security:global-method-security>
82

  
83
    <bean id="webexpressionHandler"
84
          class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>
85

  
86

  
74 87
</beans>
modules/uoa-repository-manager-gui/branches/aai/src/main/webapp/RepositoryManager.html
428 428

  
429 429
                            <ul class="uk-navbar-nav">
430 430
                                <li class="uk-parent">
431
                                    <a class="loginLink" href="#login">
431
                                    <a class="loginLink" href="https://aai.openminted.eu/oidc/">
432 432
                                        <span class="uk-margin-small-right uk-icon"><svg height="20" ratio="1" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.9" cy="6.4" fill="none" r="4.4" stroke="#000" stroke-width="1.1"></circle><path d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2" fill="none" stroke="#000" stroke-width="1.1"></path></svg>
433 433
                                        </span>
434 434
                                         Sign in | Register
modules/uoa-repository-manager-gui/branches/aai/pom.xml
268 268
            <version>1.7.3</version>
269 269
        </dependency>
270 270

  
271
        <dependency>
272
            <groupId>org.mitre</groupId>
273
            <artifactId>openid-connect-client</artifactId>
274
            <version>1.3.0</version>
275
        </dependency>
271 276

  
272 277
        <dependency>
273 278
            <groupId>eu.dnetlib</groupId>
......
275 280
            <version>1.0.0-SNAPSHOT</version>
276 281
        </dependency>
277 282

  
278

  
279

  
280 283
    </dependencies>
281 284

  
282 285

  

Also available in: Unified diff