Project

General

Profile

« Previous | Next » 

Revision 50296

1. AAI communication established
2. Move validator methods to back end.

View differences:

modules/uoa-repository-manager-gui/branches/aai/src/main/java/eu/dnetlib/repo/manager/server/utils/FrontEndLinkURIAuthenticationSuccessHandler.java
1
package eu.dnetlib.repo.manager.server.utils;
2

  
3
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
4
import org.springframework.security.core.Authentication;
5
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
6

  
7
import javax.servlet.ServletException;
8
import javax.servlet.http.Cookie;
9
import javax.servlet.http.HttpServletRequest;
10
import javax.servlet.http.HttpServletResponse;
11
import java.io.IOException;
12

  
13

  
14
public class FrontEndLinkURIAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
15

  
16

  
17
    private String frontEndURI;
18

  
19
    @Override
20
    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
21
        OIDCAuthenticationToken authOIDC = (OIDCAuthenticationToken) authentication;
22
        Cookie sessionCookie = new Cookie("name", authOIDC.getUserInfo().getName());
23
        int expireSec = -1;
24
        sessionCookie.setMaxAge(expireSec);
25
        sessionCookie.setPath("/");
26
        response.addCookie(sessionCookie);
27
        response.sendRedirect(frontEndURI);
28
    }
29

  
30
    public String getFrontEndURI() {
31
        return frontEndURI;
32
    }
33

  
34
    public void setFrontEndURI(String frontEndURI) {
35
        this.frontEndURI = frontEndURI;
36
    }
37
}
modules/uoa-repository-manager-gui/branches/aai/src/main/java/eu/dnetlib/repo/manager/server/services/ValidationServiceImpl.java
40 40
    @Value("${services.repo-manager.deploy.environment}")
41 41
    private String deployEnvironment;
42 42

  
43
    private ServiceLocator<ValidatorService> validatorServiceLocator;
43
    //private ServiceLocator<ValidatorService> validatorServiceLocator;
44 44

  
45 45
    //private Map<String, List<RuleSet>> rulesetMap = new ConcurrentHashMap<String, List<RuleSet>>();
46 46

  
......
148 148
//            if (this.userOverridesRepoRegistration(user))
149 149
//                jobs = getValidationService().getStoredJobs(null, jobType, offset, limit, null, null);
150 150
//            else
151
            jobs = getValidationService().getStoredJobsNew(user, jobType, offset, limit, dateFrom, dateTo, validationStatus);
151
            jobs = validatorApi.getStoredJobsNew(user, jobType, offset, limit, dateFrom, dateTo, validationStatus);
152
           // jobs = getValidationService().getStoredJobsNew(user, jobType, offset, limit, dateFrom, dateTo, validationStatus);
152 153
            return jobs;
153 154
//            return monitorApi.getJobsOfUser(user, jobType, offset, limit, dateFrom, dateTo, validationStatus);
154 155
        } catch (Exception e) {
......
167 168
//            if (this.userOverridesRepoRegistration(user))
168 169
//                sum = getValidationService().getStoredJobsTotalNumber(null, jobType);
169 170
//            else
170
            sum = getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
171
            //sum = getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
172
            sum = validatorApi.getStoredJobsTotalNumberNew(user, jobType, validationStatus);
171 173
            return sum;
172 174
        } catch (Exception e) {
173 175
            LOGGER.error("Error getting jobs of user " + user, e);
......
192 194
    }
193 195

  
194 196

  
195
    private ValidatorService getValidationService() {
197
  /*  private ValidatorService getValidationService() {
196 198
        return this.validatorServiceLocator.getService();
197 199
    }
198 200

  
......
202 204

  
203 205
    public void setValidatorServiceLocator(ServiceLocator<ValidatorService> validatorServiceLocator) {
204 206
        this.validatorServiceLocator = validatorServiceLocator;
205
    }
207
    }*/
206 208
}
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"
4 3
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
       xmlns:task="http://www.springframework.org/schema/task"
6 4
       xmlns:security="http://www.springframework.org/schema/security"
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/task http://www.springframework.org/schema/task/spring-task.xsd
9
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"
5
       xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
6
       xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
7
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
8
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
9

  
10
		  http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd"
10 11
       default-autowire="byType">
11 12

  
13

  
12 14
    <task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
13 15
    <task:executor id="myExecutor" pool-size="5"/>
14 16
    <task:scheduler id="myScheduler" pool-size="10"/>
15 17

  
18

  
19

  
16 20
    <bean id="maillib" class="eu.dnetlib.utils.MailLibrary" init-method="init">
17 21
        <property name="mailhost" value="${services.validator.mail.host}"/>
18 22
        <property name="smtpPort" value="${services.validator.mail.port}"/>
......
25 29
        <property name="debug" value="${services.validator.mail.debug}"/>
26 30
    </bean>
27 31

  
28
    <security:global-method-security pre-post-annotations="enabled" proxy-target-class="true" authentication-manager-ref="authenticationManager"/>
32
    <bean id="webexpressionHandler"
33
          class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>
29 34

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

  
30 38
    <security:http auto-config="false" use-expressions="true"
31 39
                   disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint"
32 40
                   pattern="/**">
......
66 74
    </util:set>
67 75

  
68 76

  
69
    <bean class="eu.openminted.registry.beans.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect">
77
    <bean class="eu.dnetlib.repo.manager.server.utils.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect">
70 78
        <property name="frontEndURI" value="${webapp.front}"/>
71 79
    </bean>
72 80
    <!--
modules/uoa-repository-manager-gui/branches/aai/src/main/resources/eu/dnetlib/repo/manager/server/springContext-repo-manager.properties
59 59
services.repomanager.usagestats.adminEmail = repositoryusagestats@openaire.eu
60 60

  
61 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
62
oidc.id = 24e83176-1312-4ba3-bc0b-ffeebea1603e
63
oidc.secret = U_gLOupYu2trYIOwfxGgZkkZoOHG_zGfaViOUsXcZ7qVQuF1rcJeQYKIDX1TY3z27CIoHaqq9ht2rmAiUmBRYQ
64
webapp.home = http://localhost:8380/uoa-repository-manager-gui/openid_connect_login
65
webapp.front=http://localhost:8380/uoa-repository-manager-gui/
modules/uoa-repository-manager-gui/branches/aai/src/main/webapp/WEB-INF/applicationContext.xml
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 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
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd">
11 10

  
12 11

  
13 12

  
14 13
    <import resource="classpath:META-INF/cxf/cxf.xml"/>
15
    <!--<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>-->
16 14
    <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
17 15
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
18 16
    <import resource="classpath*:/cxf.xml"/>
......
26 24
    <import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
27 25
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
28 26
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
27
    <import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>
29 28

  
30 29
    <import resource="classpath*:/eu/dnetlib/gwt/**/springContext-widgets.xml"/>
31 30

  
......
74 73
        </property>
75 74
    </bean>
76 75

  
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

  
87 76
</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="https://aai.openminted.eu/oidc/">
431
                                    <a class="loginLink" href="/uoa-repository-manager-gui/openid_connect_login">
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
272 272
            <groupId>org.mitre</groupId>
273 273
            <artifactId>openid-connect-client</artifactId>
274 274
            <version>1.3.0</version>
275
            <exclusions>
276
                <exclusion>
277
                    <groupId>org.slf4j</groupId>
278
                    <artifactId>jcl-over-slf4j</artifactId>
279
                </exclusion>
280
            </exclusions>
275 281
        </dependency>
276 282

  
277 283
        <dependency>

Also available in: Unified diff