Project

General

Profile

« Previous | Next » 

Revision 50570

1. Add getMetricsInfoForRepository and getInterfaceInformation methods.
2. Create aai-secutiry.xml file
3. Add properties on application file

View differences:

modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApi.java
4 4
import eu.dnetlib.domain.functionality.validator.JobForValidation;
5 5
import eu.dnetlib.domain.functionality.validator.RuleSet;
6 6
import eu.dnetlib.domain.functionality.validator.StoredJob;
7
import eu.dnetlib.repo.manager.shared.InterfaceInformation;
7 8
import eu.dnetlib.repo.manager.shared.ValidationServiceException;
8 9
import io.swagger.annotations.Api;
9 10
import org.json.JSONException;
......
52 53
    @ResponseBody
53 54
    int getStoredJobsTotalNumberNew(String user, String jobType, String validationStatus) throws ValidatorServiceException;
54 55

  
56
    @RequestMapping(value = "/getInterfaceInformation/{baseUrl}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
57
    @ResponseBody
58
    InterfaceInformation getInterfaceInformation(String baseUrl) throws ValidationServiceException;
55 59
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java
71 71
            for (JsonNode term : root.path("terms") )
72 72
                topics.put(term.path("code").textValue(), parseTerm(term));
73 73
        } catch (IOException e) {
74
            LOGGER.debug(e);
74 75
            e.printStackTrace();
75 76
        }
76 77
    }
......
361 362
                                                       ) throws BrokerException {
362 363

  
363 364
        UriComponents uriComponents = UriComponentsBuilder
364
                .fromHttpUrl(apiPath + "/openaireBroker/notifications/")
365
                .fromHttpUrl(openairePath + "/notifications/")
365 366
                .path("/{id}/{page}/{size}/")
366 367
                .build().expand(subscriptionId,page, size).encode();
367 368

  
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApiImpl.java
3 3
import eu.dnetlib.api.functionality.ValidatorServiceException;
4 4
import eu.dnetlib.domain.functionality.validator.StoredJob;
5 5
import eu.dnetlib.repo.manager.service.utils.OaiTools;
6
import eu.dnetlib.repo.manager.shared.InterfaceInformation;
7
import eu.dnetlib.repo.manager.shared.ValidationServiceException;
6 8
import gr.uoa.di.driver.util.ServiceLocator;
7 9
import eu.dnetlib.domain.functionality.validator.JobForValidation;
8 10
import eu.dnetlib.domain.functionality.validator.RuleSet;
......
122 124
    }
123 125

  
124 126
    @Override
125
    public List<String> getSetsOfRepository(String url) {
127
    public List<String> getSetsOfRepository(@PathVariable("url") String url) {
126 128
        LOGGER.debug("Getting sets of repository with url : " + url);
127 129
        try {
128 130
            return OaiTools.getSetsOfRepo(url);
......
133 135
    }
134 136

  
135 137
    @Override
136
    public boolean identifyRepo(String url) {
138
    public boolean identifyRepo(@PathVariable("url") String url) {
137 139
        LOGGER.debug("Identify repository with url : " + url);
138 140
        try {
139 141
            return OaiTools.identifyRepository(url);
......
144 146
    }
145 147

  
146 148
    @Override
147
    public RuleSet getRuleSet(String acronym) {
149
    public RuleSet getRuleSet(@PathVariable("acronym") String acronym) {
148 150
        LOGGER.debug("Getting ruleset with acronym : " + acronym);
149 151
        RuleSet ruleSet = null;
150 152
        try {
......
173 175
        return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
174 176
    }
175 177

  
178
    @Override
179
    public InterfaceInformation getInterfaceInformation(@PathVariable("baseUrl") String baseUrl) throws ValidationServiceException {
180
        try {
181
            LOGGER.debug("Getting interface information with url: " + baseUrl);
182
            InterfaceInformation interfaceInformation = new InterfaceInformation();
183
            interfaceInformation.setIdentified(this.identifyRepo(baseUrl));
184
            if (interfaceInformation.isIdentified())
185
                interfaceInformation.setSets(this.getSetsOfRepository(baseUrl));
176 186

  
187
            return interfaceInformation;
188
        } catch (Exception e) {
189
            LOGGER.error("Error getting interface information with url: " + baseUrl, e);
190
//            emailUtils.reportException(e);
191
            throw new ValidationServiceException("login.generalError", ValidationServiceException.ErrorCode.GENERAL_ERROR);
192
        }
193
    }
194

  
195

  
177 196
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/MonitorApiImpl.java
6 6
import eu.dnetlib.repo.manager.shared.JobsOfUser;
7 7
import eu.dnetlib.repo.manager.shared.Constants;
8 8
import gr.uoa.di.driver.util.ServiceLocator;
9
import io.swagger.annotations.ApiParam;
9 10
import org.apache.log4j.Logger;
10 11
import org.json.JSONException;
11 12
import org.springframework.stereotype.Component;
......
34 35
            .getLogger(MonitorApiImpl.class);
35 36

  
36 37
    @Override
37
    public JobsOfUser getJobsOfUser(String user,
38
                                         String jobType,
39
                                         String offset,
40
                                         String limit,
41
                                         String dateFrom,
42
                                         String dateTo,
43
                                         String validationStatus,
44
                                         String includeJobsTotal) throws JSONException, ValidatorServiceException {
38
    public JobsOfUser getJobsOfUser(@ApiParam(value = "User email", required = true) String user,
39
                                    @ApiParam(value = "Equals to filter job type on validation history page", required = true) String jobType,
40
                                    @ApiParam(value = "Page number", required = true) String offset,
41
                                    @ApiParam(value = "Null value", required = true) String limit,
42
                                    @ApiParam(value = "Null value", required = true) String dateFrom,
43
                                    @ApiParam(value = "Null value", required = true) String dateTo,
44
                                    @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus,
45
                                    @ApiParam(value = "Always true", required = true) String includeJobsTotal) throws JSONException, ValidatorServiceException {
45 46

  
46 47
        LOGGER.debug("Getting jobs of user : " + user);
48
        LOGGER.debug(user + "/" + jobType + "/" + offset + "/" + dateFrom + "/" + dateTo + "/" + validationStatus + "/" + includeJobsTotal);
47 49
        JobsOfUser retJobs = new JobsOfUser();
48 50
        retJobs.setJobs(getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset),
49 51
                Integer.parseInt(limit), dateFrom, dateTo, validationStatus));
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApi.java
2 2

  
3 3
import eu.dnetlib.domain.data.Repository;
4 4
import eu.dnetlib.domain.data.RepositoryInterface;
5
import eu.dnetlib.repo.manager.shared.Aggregations;
6
import eu.dnetlib.repo.manager.shared.Country;
7
import eu.dnetlib.repo.manager.shared.Timezone;
5
import eu.dnetlib.repo.manager.shared.*;
8 6
import io.swagger.annotations.Api;
9 7
import org.json.JSONException;
10 8
import org.springframework.http.MediaType;
......
166 164

  
167 165

  
168 166
    String getCountryName(String countryCode);
167

  
168
    @RequestMapping(value = "/getMetricsInfoForRepository/{repoId}",method = RequestMethod.GET,
169
            produces = MediaType.APPLICATION_JSON_VALUE)
170
    @ResponseBody
171
    MetricsInfo getMetricsInfoForRepository(String repoId) throws RepositoryServiceException;
169 172
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApiImpl.java
6 6
import eu.dnetlib.domain.data.RepositoryInterface;
7 7
import eu.dnetlib.domain.enabling.Vocabulary;
8 8
import eu.dnetlib.repo.manager.service.utils.Converter;
9
import eu.dnetlib.repo.manager.shared.Aggregations;
10
import eu.dnetlib.repo.manager.shared.Constants;
11
import eu.dnetlib.repo.manager.shared.Country;
12
import eu.dnetlib.repo.manager.shared.Timezone;
9
import eu.dnetlib.repo.manager.shared.*;
13 10
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
11
import org.apache.commons.codec.digest.DigestUtils;
14 12
import org.apache.log4j.Logger;
15 13
import org.json.JSONArray;
16 14
import org.json.JSONException;
17 15
import org.json.JSONObject;
18 16
import org.springframework.beans.factory.annotation.Autowired;
19 17
import org.springframework.beans.factory.annotation.Value;
18
import org.springframework.core.ParameterizedTypeReference;
20 19
import org.springframework.http.HttpEntity;
21 20
import org.springframework.http.HttpHeaders;
21
import org.springframework.http.HttpMethod;
22
import org.springframework.http.ResponseEntity;
22 23
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
23 24
import org.springframework.stereotype.Component;
24 25
import org.springframework.web.bind.annotation.PathVariable;
25 26
import org.springframework.web.bind.annotation.RequestBody;
26 27
import org.springframework.web.bind.annotation.RequestParam;
28
import org.springframework.web.client.RestClientException;
27 29
import org.springframework.web.client.RestTemplate;
28 30
import org.springframework.web.util.UriComponents;
29 31
import org.springframework.web.util.UriComponentsBuilder;
......
49 51

  
50 52
    private static final Logger LOGGER = Logger.getLogger(RepositoryApiImpl.class);
51 53

  
54
    @Value("${services.repomanager.usageStatisticsDiagramsBaseURL}")
55
    private String usageStatisticsDiagramsBaseURL;
56

  
57
    @Value("${services.repomanager.usageStatisticsNumbersBaseURL}")
58
    private String usageStatisticsNumbersBaseURL;
59

  
52 60
    @Autowired
53 61
    private VocabularyLoader vocabularyLoader;
54 62

  
......
581 589

  
582 590
    @Override
583 591
    public String updateLatitude(@RequestParam(value = "id")   String id,
584
                                 @RequestParam(value = "managed")  String latitude) {
592
                                 @RequestParam(value = "latitude")  String latitude) {
585 593

  
586 594
        UriComponents uriComponents = UriComponentsBuilder
587 595
                .fromHttpUrl(baseAddress + "/ds/latitude/")
......
763 771
        return inverseCountriesMap.get(countryCode);
764 772
    }
765 773

  
774
    @Override
775
    public MetricsInfo getMetricsInfoForRepository(@PathVariable("repoId")  String repoId) throws RepositoryServiceException {
776
        try {
777

  
778
            MetricsInfo metricsInfo = new MetricsInfo();
779
            metricsInfo.setDiagramsBaseURL(this.usageStatisticsDiagramsBaseURL);
780
            metricsInfo.setMetricsNumbers(getMetricsNumbers(getOpenAIREId(repoId)));
781
            return metricsInfo;
782

  
783
        } catch (Exception e) {
784
            LOGGER.error("Error while getting metrics info for repository: ", e);
785
            //emailUtils.reportException(e);
786
            throw new RepositoryServiceException("General error", RepositoryServiceException.ErrorCode.GENERAL_ERROR);
787
        }
788
    }
789

  
790
    private MetricsNumbers getMetricsNumbers(String openAIREID) throws BrokerException {
791

  
792
        //build the uri params
793
        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.usageStatisticsNumbersBaseURL + openAIREID + "/clicks");
794

  
795
        //create new template engine
796
        RestTemplate template = new RestTemplate();
797
        template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
798
        ResponseEntity<MetricsNumbers> resp;
799
        try {
800
            //communicate with endpoint
801
            resp = template.exchange(
802
                    builder.build().encode().toUri(),
803
                    HttpMethod.GET,
804
                    null,
805
                    new ParameterizedTypeReference<MetricsNumbers>() {
806
                    });
807
        } catch (RestClientException e) {
808
            throw e;
809
        }
810

  
811
        return resp.getBody();
812
    }
813

  
814
    private String getOpenAIREId(String repoId) {
815

  
816
        if (repoId != null && repoId.contains("::")) {
817
            return repoId.split("::")[0] + "::" + DigestUtils.md5Hex(repoId.split("::")[1]);
818
        }
819

  
820
        return null;
821
    }
822

  
823

  
766 824
}
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/shared/MetricsNumbers.java
1
package eu.dnetlib.repo.manager.shared;
2

  
3
import com.fasterxml.jackson.annotation.JsonProperty;
4
import com.google.gwt.user.client.rpc.IsSerializable;
5

  
6
import java.util.List;
7

  
8
/**
9
 * Created by stefania on 11/7/17.
10
 */
11
public class MetricsNumbers implements IsSerializable {
12

  
13
    private List<String> downloads;
14
    private List<String> views;
15

  
16
    @JsonProperty("total_downloads")
17
    private String totalDownloads;
18

  
19
    @JsonProperty("total_views")
20
    private String totalViews;
21

  
22
    @JsonProperty("total_openaire_downloads")
23
    private String totalOpenAIREDownloads;
24

  
25
    @JsonProperty("total_openaire_views")
26
    private String totalOpenAIREViews;
27

  
28
    @JsonProperty("pageviews")
29
    private String pageViews;
30

  
31
    public MetricsNumbers() {
32
    }
33

  
34
    public MetricsNumbers(List<String> downloads, List<String> views, String totalDownloads, String totalViews,
35
                          String totalOpenAIREDownloads, String totalOpenAIREViews, String pageViews) {
36
        this.downloads = downloads;
37
        this.views = views;
38
        this.totalDownloads = totalDownloads;
39
        this.totalViews = totalViews;
40
        this.totalOpenAIREDownloads = totalOpenAIREDownloads;
41
        this.totalOpenAIREViews = totalOpenAIREViews;
42
        this.pageViews = pageViews;
43
    }
44

  
45
    public List<String> getDownloads() {
46
        return downloads;
47
    }
48

  
49
    public void setDownloads(List<String> downloads) {
50
        this.downloads = downloads;
51
    }
52

  
53
    public List<String> getViews() {
54
        return views;
55
    }
56

  
57
    public void setViews(List<String> views) {
58
        this.views = views;
59
    }
60

  
61
    public String getTotalDownloads() {
62
        return totalDownloads;
63
    }
64

  
65
    public void setTotalDownloads(String totalDownloads) {
66
        this.totalDownloads = totalDownloads;
67
    }
68

  
69
    public String getTotalViews() {
70
        return totalViews;
71
    }
72

  
73
    public void setTotalViews(String totalViews) {
74
        this.totalViews = totalViews;
75
    }
76

  
77
    public String getTotalOpenAIREDownloads() {
78
        return totalOpenAIREDownloads;
79
    }
80

  
81
    public void setTotalOpenAIREDownloads(String totalOpenAIREDownloads) {
82
        this.totalOpenAIREDownloads = totalOpenAIREDownloads;
83
    }
84

  
85
    public String getTotalOpenAIREViews() {
86
        return totalOpenAIREViews;
87
    }
88

  
89
    public void setTotalOpenAIREViews(String totalOpenAIREViews) {
90
        this.totalOpenAIREViews = totalOpenAIREViews;
91
    }
92

  
93
    public String getPageViews() {
94
        return pageViews;
95
    }
96

  
97
    public void setPageViews(String pageViews) {
98
        this.pageViews = pageViews;
99
    }
100
}
101

  
modules/uoa-repository-manager-service/trunk/src/main/java/eu/dnetlib/repo/manager/shared/MetricsInfo.java
1
package eu.dnetlib.repo.manager.shared;
2

  
3
import com.google.gwt.user.client.rpc.IsSerializable;
4

  
5
/**
6
 * Created by stefania on 11/6/17.
7
 */
8
public class MetricsInfo implements IsSerializable {
9

  
10
    private MetricsNumbers metricsNumbers;
11
    private String diagramsBaseURL;
12

  
13
    public MetricsInfo() {
14
    }
15

  
16
    public MetricsInfo(MetricsNumbers metricsNumbers, String diagramsBaseURL) {
17
        this.metricsNumbers = metricsNumbers;
18
        this.diagramsBaseURL = diagramsBaseURL;
19
    }
20

  
21
    public MetricsNumbers getMetricsNumbers() {
22
        return metricsNumbers;
23
    }
24

  
25
    public void setMetricsNumbers(MetricsNumbers metricsNumbers) {
26
        this.metricsNumbers = metricsNumbers;
27
    }
28

  
29
    public String getDiagramsBaseURL() {
30
        return diagramsBaseURL;
31
    }
32

  
33
    public void setDiagramsBaseURL(String diagramsBaseURL) {
34
        this.diagramsBaseURL = diagramsBaseURL;
35
    }
36
}
modules/uoa-repository-manager-service/trunk/src/main/resources/application-context.xml
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<beans xmlns="http://www.springframework.org/schema/beans"
3 3
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
       xmlns:security="http://www.springframework.org/schema/security"
5
       xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
6 4
       xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
7
       xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
8
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
9
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
5
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
6
		    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">
10 7

  
11
		  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"
12
       default-autowire="byType">
8
    <import resource="classpath*:/eu/**/aai-security.xml"/>
13 9

  
14
    <!--<import resource="classpath:META-INF/cxf/cxf.xml"/>
15
    <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
16
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
17
    <import resource="classpath*:/cxf.xml"/>
18
    <import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/>
19
    <import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/>
20
    <import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/>
21
    <import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/>
22
    <import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/>
23
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/>
24
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/>
25
    <import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
26
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
27
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
28
    <import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>-->
29
    
30 10
    <context:property-placeholder location="classpath*:/eu/**/application.properties" />
31 11
    <tx:annotation-driven transaction-manager="txManager"/>
32 12

  
33
<!--
34 13
    <bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" id="propertyLoader">
35 14
        <property name="order" value="2" />
36 15
        <property name="properties">
......
59 38
            </list>
60 39
        </property>
61 40
    </bean>
62
-->
63 41

  
64 42
    <bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
65 43
        <property name="driverClassName" value="${repomanager.db.driverClassName}" />
......
84 62
        <property name="dataSource" ref="repomanager.dataSource"/>
85 63
    </bean>
86 64

  
87
    <bean id="webexpressionHandler"
88
          class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>
89

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

  
93
    <security:http auto-config="false" use-expressions="true"
94
                   disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint"
95
                   pattern="/**">
96

  
97
        <security:custom-filter before="PRE_AUTH_FILTER" ref="openIdConnectAuthenticationFilter" />
98

  
99
        <security:logout />
100

  
101
    </security:http>
102

  
103
    <bean id="authenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint" >
104
        <constructor-arg type="java.lang.String" value="/openid_connect_login"/>
105
    </bean>
106

  
107
    <security:authentication-manager alias="authenticationManager">
108
        <security:authentication-provider ref="openIdConnectAuthenticationProvider" />
109
    </security:authentication-manager>
110

  
111
    <bean id="openIdConnectAuthenticationProvider" class="org.mitre.openid.connect.client.OIDCAuthenticationProvider">
112
        <property name="authoritiesMapper">
113
            <bean class="org.mitre.openid.connect.client.NamedAdminAuthoritiesMapper">
114
                <property name="admins" ref="namedAdmins" />
115
            </bean>
116
        </property>
117
    </bean>
118

  
119
    <util:set id="namedAdmins" value-type="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
120
        <!--
121
            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.
122
            Note that having an administrator role on the IdP doesn't grant administrator access on this client.
123
            These are values from the demo "openid-connect-server-webapp" project of MITREid Connect.
124
        -->
125
        <bean class="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
126
            <constructor-arg name="subject" value="90342.ASDFJWFA" />
127
            <constructor-arg name="issuer" value="${oidc.issuer}" />
128
        </bean>
129
    </util:set>
130

  
131
    <bean class="eu.dnetlib.repo.manager.service.utils.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect">
132
        <property name="frontEndURI" value="${webapp.front}"/>
133
    </bean>
134
    <!--
135
      -
136
      - The authentication filter
137
      -
138
      -->
139
    <bean id="openIdConnectAuthenticationFilter" class="org.mitre.openid.connect.client.OIDCAuthenticationFilter">
140
        <property name="authenticationManager" ref="authenticationManager" />
141

  
142
        <property name="issuerService" ref="staticIssuerService" />
143
        <property name="serverConfigurationService" ref="staticServerConfigurationService" />
144
        <property name="clientConfigurationService" ref="staticClientConfigurationService" />
145
        <property name="authRequestOptionsService" ref="staticAuthRequestOptionsService" />
146
        <property name="authRequestUrlBuilder" ref="plainAuthRequestUrlBuilder" />
147
        <property name="authenticationSuccessHandler" ref="frontEndRedirect"/>
148

  
149
    </bean>
150

  
151

  
152

  
153
    <!--
154
      -
155
      -	Issuer Services: Determine which identity provider issuer is used.
156
      -
157
      -->
158

  
159

  
160
    <!--
161
        Static issuer service, returns the same issuer for every request.
162
    -->
163
    <bean class="org.mitre.openid.connect.client.service.impl.StaticSingleIssuerService" id="staticIssuerService">
164
        <property name="issuer" value="${oidc.issuer}" />
165
    </bean>
166

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

  
172
    <!--
173
		Dynamic server configuration, fetches the server's information using OIDC Discovery.
174
	-->
175
    <bean class="org.mitre.openid.connect.client.service.impl.StaticServerConfigurationService" id="staticServerConfigurationService">
176
        <property name="servers">
177
            <map>
178
                <entry key="${oidc.issuer}">
179
                    <bean class="org.mitre.openid.connect.config.ServerConfiguration">
180
                        <property name="issuer" value="${oidc.issuer}" />
181
                        <property name="authorizationEndpointUri"	value="${oidc.issuer}authorize" />
182
                        <property name="tokenEndpointUri"	value="${oidc.issuer}token" />
183
                        <property name="userInfoUri" value="${oidc.issuer}userinfo" />
184
                        <property name="jwksUri" value="${oidc.issuer}jwk" />
185
                        <property name="revocationEndpointUri" value="${oidc.issuer}revoke" />
186
                    </bean>
187
                </entry>
188
            </map>
189
        </property>
190
    </bean>
191

  
192

  
193
    <!--
194
       Static Client Configuration. Configures a client statically by storing configuration on a per-issuer basis.
195
   -->
196

  
197
    <bean class="org.mitre.openid.connect.client.service.impl.StaticClientConfigurationService" id="staticClientConfigurationService">
198
        <property name="clients">
199
            <map>
200
                <entry key="${oidc.issuer}">
201
                    <bean class="org.mitre.oauth2.model.RegisteredClient">
202
                        <property name="clientId" value="${oidc.id}" />
203
                        <property name="clientSecret" value="${oidc.secret}" />
204
                        <property name="scope">
205
                            <set value-type="java.lang.String">
206
                                <value>openid</value>
207
                            </set>
208
                        </property>
209
                        <property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
210
                        <property name="redirectUris">
211
                            <set>
212
                                <value>${webapp.home}</value>
213
                            </set>
214
                        </property>
215
                    </bean>
216
                </entry>
217
            </map>
218
        </property>
219
    </bean>
220

  
221

  
222
    <!--
223
	  -
224
	  -	Auth request options service: returns the optional components of the request
225
	  -
226
	  -->
227
    <bean class="org.mitre.openid.connect.client.service.impl.StaticAuthRequestOptionsService" id="staticAuthRequestOptionsService">
228
        <property name="options">
229
            <map>
230
                <!-- Entries in this map are sent as key-value parameters quantity the auth request -->
231
                <!--
232
                <entry key="display" value="page" />
233
                <entry key="max_age" value="30" />
234
                <entry key="prompt" value="none" />
235
                -->
236
            </map>
237
        </property>
238
    </bean>
239

  
240
    <!--
241
	  -
242
	  - Authorization URL Builders: create the URL quantity redirect the user quantity for authorization.
243
	  -
244
	  -->
245

  
246
    <!--
247
        Plain authorization request builder, puts all options as query parameters on the GET request
248
    -->
249
    <bean class="org.mitre.openid.connect.client.service.impl.PlainAuthRequestUrlBuilder" id="plainAuthRequestUrlBuilder" />
250

  
251 65
</beans>
modules/uoa-repository-manager-service/trunk/src/main/resources/eu/dnetlib/repo/manager/service/application.properties
106 106

  
107 107
redis.host = 83.212.101.85
108 108
#redis.port = 6379
109
#redis.password
109
#redis.password
110

  
111
services.repomanager.usageStatisticsDiagramsBaseURL = https://beta.openaire.eu/stats3/
112
services.repomanager.usageStatisticsNumbersBaseURL = https://beta.services.openaire.eu/usagestats/datasources/
113
services.repomanager.usagestats.adminEmail = repositoryusagestats@openaire.eu
modules/uoa-repository-manager-service/trunk/src/main/resources/eu/dnetlib/repo/manager/service/aai-security.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
       xmlns:security="http://www.springframework.org/schema/security"
5
       xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
6
       xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
7
       xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
8
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
9
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
10

  
11
		  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"
12
       default-autowire="byType">
13

  
14

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

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

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

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

  
27
    <security:logout />
28

  
29
    </security:http>
30

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

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

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

  
47
    <util:set id="namedAdmins" value-type="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
48
    <!--
49
        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.
50
        Note that having an administrator role on the IdP doesn't grant administrator access on this client.
51
        These are values from the demo "openid-connect-server-webapp" project of MITREid Connect.
52
    -->
53
    <bean class="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
54
        <constructor-arg name="subject" value="90342.ASDFJWFA" />
55
        <constructor-arg name="issuer" value="${oidc.issuer}" />
56
    </bean>
57
    </util:set>
58

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

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

  
77
    </bean>
78

  
79

  
80

  
81
            <!--
82
              -
83
              -	Issuer Services: Determine which identity provider issuer is used.
84
              -
85
              -->
86

  
87

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

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

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

  
120

  
121
            <!--
122
               Static Client Configuration. Configures a client statically by storing configuration on a per-issuer basis.
123
           -->
124

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

  
149

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

  
168
            <!--
169
              -
170
              - Authorization URL Builders: create the URL quantity redirect the user quantity for authorization.
171
              -
172
              -->
173

  
174
            <!--
175
                Plain authorization request builder, puts all options as query parameters on the GET request
176
            -->
177
    <bean class="org.mitre.openid.connect.client.service.impl.PlainAuthRequestUrlBuilder" id="plainAuthRequestUrlBuilder" />
178
</beans>
modules/uoa-repository-manager-service/trunk/src/main/webapp/WEB-INF/applicationContext.xml
15 15
    <!-- <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>-->
16 16

  
17 17
    <!--<import resource="classpath:META-INF/cxf/cxf.xml"/>
18
    <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
19
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
20
    <import resource="classpath*:/cxf.xml"/>
21
    <import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/>
22
    <import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/>
23
    <import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/>
24
    <import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/>
25
    <import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/>
26
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/>
27
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/>
28
    <import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
29
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
30
    <import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
31
    <import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>-->
18 32

  
19
     <import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
20
     <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
21
     <import resource="classpath*:/cxf.xml"/>
22
     <import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/>
23
     <import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/>
24
     <import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/>
25
     <import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/>
26
     <import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/>
27
     <import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/>
28
     <import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/>
29
     <import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
30
     <import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
31
     <import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
32 33

  
33
     <import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>-->
34 34
    <context:property-placeholder location="classpath*:/eu/**/application.properties" />
35 35

  
36 36
    <bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" id="propertyLoader">

Also available in: Unified diff