1. Add getMetricsInfoForRepository and getInterfaceInformation methods.

2. Create aai-secutiry.xml file
3. Add properties on application file
This commit is contained in:
Panagiotis Kanakakis 2018-02-02 13:28:00 +00:00
parent bfed3f0d8c
commit 1362fbb098
12 changed files with 444 additions and 224 deletions

View File

@ -71,6 +71,7 @@ public class BrokerApiImpl implements BrokerApi {
for (JsonNode term : root.path("terms") )
topics.put(term.path("code").textValue(), parseTerm(term));
} catch (IOException e) {
LOGGER.debug(e);
e.printStackTrace();
}
}
@ -361,7 +362,7 @@ public class BrokerApiImpl implements BrokerApi {
) throws BrokerException {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(apiPath + "/openaireBroker/notifications/")
.fromHttpUrl(openairePath + "/notifications/")
.path("/{id}/{page}/{size}/")
.build().expand(subscriptionId,page, size).encode();

View File

@ -6,6 +6,7 @@ import eu.dnetlib.domain.functionality.validator.StoredJob;
import eu.dnetlib.repo.manager.shared.JobsOfUser;
import eu.dnetlib.repo.manager.shared.Constants;
import gr.uoa.di.driver.util.ServiceLocator;
import io.swagger.annotations.ApiParam;
import org.apache.log4j.Logger;
import org.json.JSONException;
import org.springframework.stereotype.Component;
@ -34,16 +35,17 @@ public class MonitorApiImpl implements MonitorApi {
.getLogger(MonitorApiImpl.class);
@Override
public JobsOfUser getJobsOfUser(String user,
String jobType,
String offset,
String limit,
String dateFrom,
String dateTo,
String validationStatus,
String includeJobsTotal) throws JSONException, ValidatorServiceException {
public JobsOfUser getJobsOfUser(@ApiParam(value = "User email", required = true) String user,
@ApiParam(value = "Equals to filter job type on validation history page", required = true) String jobType,
@ApiParam(value = "Page number", required = true) String offset,
@ApiParam(value = "Null value", required = true) String limit,
@ApiParam(value = "Null value", required = true) String dateFrom,
@ApiParam(value = "Null value", required = true) String dateTo,
@ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus,
@ApiParam(value = "Always true", required = true) String includeJobsTotal) throws JSONException, ValidatorServiceException {
LOGGER.debug("Getting jobs of user : " + user);
LOGGER.debug(user + "/" + jobType + "/" + offset + "/" + dateFrom + "/" + dateTo + "/" + validationStatus + "/" + includeJobsTotal);
JobsOfUser retJobs = new JobsOfUser();
retJobs.setJobs(getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset),
Integer.parseInt(limit), dateFrom, dateTo, validationStatus));

View File

@ -2,9 +2,7 @@ package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.domain.data.Repository;
import eu.dnetlib.domain.data.RepositoryInterface;
import eu.dnetlib.repo.manager.shared.Aggregations;
import eu.dnetlib.repo.manager.shared.Country;
import eu.dnetlib.repo.manager.shared.Timezone;
import eu.dnetlib.repo.manager.shared.*;
import io.swagger.annotations.Api;
import org.json.JSONException;
import org.springframework.http.MediaType;
@ -166,4 +164,9 @@ public interface RepositoryApi {
String getCountryName(String countryCode);
@RequestMapping(value = "/getMetricsInfoForRepository/{repoId}",method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
MetricsInfo getMetricsInfoForRepository(String repoId) throws RepositoryServiceException;
}

View File

@ -6,24 +6,26 @@ import eu.dnetlib.domain.data.Repository;
import eu.dnetlib.domain.data.RepositoryInterface;
import eu.dnetlib.domain.enabling.Vocabulary;
import eu.dnetlib.repo.manager.service.utils.Converter;
import eu.dnetlib.repo.manager.shared.Aggregations;
import eu.dnetlib.repo.manager.shared.Constants;
import eu.dnetlib.repo.manager.shared.Country;
import eu.dnetlib.repo.manager.shared.Timezone;
import eu.dnetlib.repo.manager.shared.*;
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
@ -49,6 +51,12 @@ public class RepositoryApiImpl implements RepositoryApi {
private static final Logger LOGGER = Logger.getLogger(RepositoryApiImpl.class);
@Value("${services.repomanager.usageStatisticsDiagramsBaseURL}")
private String usageStatisticsDiagramsBaseURL;
@Value("${services.repomanager.usageStatisticsNumbersBaseURL}")
private String usageStatisticsNumbersBaseURL;
@Autowired
private VocabularyLoader vocabularyLoader;
@ -581,7 +589,7 @@ public class RepositoryApiImpl implements RepositoryApi {
@Override
public String updateLatitude(@RequestParam(value = "id") String id,
@RequestParam(value = "managed") String latitude) {
@RequestParam(value = "latitude") String latitude) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/latitude/")
@ -763,4 +771,54 @@ public class RepositoryApiImpl implements RepositoryApi {
return inverseCountriesMap.get(countryCode);
}
@Override
public MetricsInfo getMetricsInfoForRepository(@PathVariable("repoId") String repoId) throws RepositoryServiceException {
try {
MetricsInfo metricsInfo = new MetricsInfo();
metricsInfo.setDiagramsBaseURL(this.usageStatisticsDiagramsBaseURL);
metricsInfo.setMetricsNumbers(getMetricsNumbers(getOpenAIREId(repoId)));
return metricsInfo;
} catch (Exception e) {
LOGGER.error("Error while getting metrics info for repository: ", e);
//emailUtils.reportException(e);
throw new RepositoryServiceException("General error", RepositoryServiceException.ErrorCode.GENERAL_ERROR);
}
}
private MetricsNumbers getMetricsNumbers(String openAIREID) throws BrokerException {
//build the uri params
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(this.usageStatisticsNumbersBaseURL + openAIREID + "/clicks");
//create new template engine
RestTemplate template = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
ResponseEntity<MetricsNumbers> resp;
try {
//communicate with endpoint
resp = template.exchange(
builder.build().encode().toUri(),
HttpMethod.GET,
null,
new ParameterizedTypeReference<MetricsNumbers>() {
});
} catch (RestClientException e) {
throw e;
}
return resp.getBody();
}
private String getOpenAIREId(String repoId) {
if (repoId != null && repoId.contains("::")) {
return repoId.split("::")[0] + "::" + DigestUtils.md5Hex(repoId.split("::")[1]);
}
return null;
}
}

View File

@ -4,6 +4,7 @@ import eu.dnetlib.api.functionality.ValidatorServiceException;
import eu.dnetlib.domain.functionality.validator.JobForValidation;
import eu.dnetlib.domain.functionality.validator.RuleSet;
import eu.dnetlib.domain.functionality.validator.StoredJob;
import eu.dnetlib.repo.manager.shared.InterfaceInformation;
import eu.dnetlib.repo.manager.shared.ValidationServiceException;
import io.swagger.annotations.Api;
import org.json.JSONException;
@ -52,4 +53,7 @@ public interface ValidatorApi {
@ResponseBody
int getStoredJobsTotalNumberNew(String user, String jobType, String validationStatus) throws ValidatorServiceException;
@RequestMapping(value = "/getInterfaceInformation/{baseUrl}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
InterfaceInformation getInterfaceInformation(String baseUrl) throws ValidationServiceException;
}

View File

@ -3,6 +3,8 @@ package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.api.functionality.ValidatorServiceException;
import eu.dnetlib.domain.functionality.validator.StoredJob;
import eu.dnetlib.repo.manager.service.utils.OaiTools;
import eu.dnetlib.repo.manager.shared.InterfaceInformation;
import eu.dnetlib.repo.manager.shared.ValidationServiceException;
import gr.uoa.di.driver.util.ServiceLocator;
import eu.dnetlib.domain.functionality.validator.JobForValidation;
import eu.dnetlib.domain.functionality.validator.RuleSet;
@ -122,7 +124,7 @@ public class ValidatorApiImpl implements ValidatorApi{
}
@Override
public List<String> getSetsOfRepository(String url) {
public List<String> getSetsOfRepository(@PathVariable("url") String url) {
LOGGER.debug("Getting sets of repository with url : " + url);
try {
return OaiTools.getSetsOfRepo(url);
@ -133,7 +135,7 @@ public class ValidatorApiImpl implements ValidatorApi{
}
@Override
public boolean identifyRepo(String url) {
public boolean identifyRepo(@PathVariable("url") String url) {
LOGGER.debug("Identify repository with url : " + url);
try {
return OaiTools.identifyRepository(url);
@ -144,7 +146,7 @@ public class ValidatorApiImpl implements ValidatorApi{
}
@Override
public RuleSet getRuleSet(String acronym) {
public RuleSet getRuleSet(@PathVariable("acronym") String acronym) {
LOGGER.debug("Getting ruleset with acronym : " + acronym);
RuleSet ruleSet = null;
try {
@ -173,5 +175,22 @@ public class ValidatorApiImpl implements ValidatorApi{
return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
}
@Override
public InterfaceInformation getInterfaceInformation(@PathVariable("baseUrl") String baseUrl) throws ValidationServiceException {
try {
LOGGER.debug("Getting interface information with url: " + baseUrl);
InterfaceInformation interfaceInformation = new InterfaceInformation();
interfaceInformation.setIdentified(this.identifyRepo(baseUrl));
if (interfaceInformation.isIdentified())
interfaceInformation.setSets(this.getSetsOfRepository(baseUrl));
return interfaceInformation;
} catch (Exception e) {
LOGGER.error("Error getting interface information with url: " + baseUrl, e);
// emailUtils.reportException(e);
throw new ValidationServiceException("login.generalError", ValidationServiceException.ErrorCode.GENERAL_ERROR);
}
}
}

View File

@ -0,0 +1,36 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefania on 11/6/17.
*/
public class MetricsInfo implements IsSerializable {
private MetricsNumbers metricsNumbers;
private String diagramsBaseURL;
public MetricsInfo() {
}
public MetricsInfo(MetricsNumbers metricsNumbers, String diagramsBaseURL) {
this.metricsNumbers = metricsNumbers;
this.diagramsBaseURL = diagramsBaseURL;
}
public MetricsNumbers getMetricsNumbers() {
return metricsNumbers;
}
public void setMetricsNumbers(MetricsNumbers metricsNumbers) {
this.metricsNumbers = metricsNumbers;
}
public String getDiagramsBaseURL() {
return diagramsBaseURL;
}
public void setDiagramsBaseURL(String diagramsBaseURL) {
this.diagramsBaseURL = diagramsBaseURL;
}
}

View File

@ -0,0 +1,101 @@
package eu.dnetlib.repo.manager.shared;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.List;
/**
* Created by stefania on 11/7/17.
*/
public class MetricsNumbers implements IsSerializable {
private List<String> downloads;
private List<String> views;
@JsonProperty("total_downloads")
private String totalDownloads;
@JsonProperty("total_views")
private String totalViews;
@JsonProperty("total_openaire_downloads")
private String totalOpenAIREDownloads;
@JsonProperty("total_openaire_views")
private String totalOpenAIREViews;
@JsonProperty("pageviews")
private String pageViews;
public MetricsNumbers() {
}
public MetricsNumbers(List<String> downloads, List<String> views, String totalDownloads, String totalViews,
String totalOpenAIREDownloads, String totalOpenAIREViews, String pageViews) {
this.downloads = downloads;
this.views = views;
this.totalDownloads = totalDownloads;
this.totalViews = totalViews;
this.totalOpenAIREDownloads = totalOpenAIREDownloads;
this.totalOpenAIREViews = totalOpenAIREViews;
this.pageViews = pageViews;
}
public List<String> getDownloads() {
return downloads;
}
public void setDownloads(List<String> downloads) {
this.downloads = downloads;
}
public List<String> getViews() {
return views;
}
public void setViews(List<String> views) {
this.views = views;
}
public String getTotalDownloads() {
return totalDownloads;
}
public void setTotalDownloads(String totalDownloads) {
this.totalDownloads = totalDownloads;
}
public String getTotalViews() {
return totalViews;
}
public void setTotalViews(String totalViews) {
this.totalViews = totalViews;
}
public String getTotalOpenAIREDownloads() {
return totalOpenAIREDownloads;
}
public void setTotalOpenAIREDownloads(String totalOpenAIREDownloads) {
this.totalOpenAIREDownloads = totalOpenAIREDownloads;
}
public String getTotalOpenAIREViews() {
return totalOpenAIREViews;
}
public void setTotalOpenAIREViews(String totalOpenAIREViews) {
this.totalOpenAIREViews = totalOpenAIREViews;
}
public String getPageViews() {
return pageViews;
}
public void setPageViews(String pageViews) {
this.pageViews = pageViews;
}
}

View File

@ -1,36 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.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">
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"
default-autowire="byType">
<import resource="classpath*:/eu/**/aai-security.xml"/>
<!--<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<import resource="classpath*:/cxf.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/>
<import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/>
<import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/>
<import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/>
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>-->
<context:property-placeholder location="classpath*:/eu/**/application.properties" />
<tx:annotation-driven transaction-manager="txManager"/>
<!--
<bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" id="propertyLoader">
<property name="order" value="2" />
<property name="properties">
@ -59,7 +38,6 @@
</list>
</property>
</bean>
-->
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${repomanager.db.driverClassName}" />
@ -84,168 +62,4 @@
<property name="dataSource" ref="repomanager.dataSource"/>
</bean>
<bean id="webexpressionHandler"
class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>
<security:global-method-security pre-post-annotations="enabled" proxy-target-class="true"
authentication-manager-ref="authenticationManager"/>
<security:http auto-config="false" use-expressions="true"
disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint"
pattern="/**">
<security:custom-filter before="PRE_AUTH_FILTER" ref="openIdConnectAuthenticationFilter" />
<security:logout />
</security:http>
<bean id="authenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint" >
<constructor-arg type="java.lang.String" value="/openid_connect_login"/>
</bean>
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="openIdConnectAuthenticationProvider" />
</security:authentication-manager>
<bean id="openIdConnectAuthenticationProvider" class="org.mitre.openid.connect.client.OIDCAuthenticationProvider">
<property name="authoritiesMapper">
<bean class="org.mitre.openid.connect.client.NamedAdminAuthoritiesMapper">
<property name="admins" ref="namedAdmins" />
</bean>
</property>
</bean>
<util:set id="namedAdmins" value-type="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
<!--
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.
Note that having an administrator role on the IdP doesn't grant administrator access on this client.
These are values from the demo "openid-connect-server-webapp" project of MITREid Connect.
-->
<bean class="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
<constructor-arg name="subject" value="90342.ASDFJWFA" />
<constructor-arg name="issuer" value="${oidc.issuer}" />
</bean>
</util:set>
<bean class="eu.dnetlib.repo.manager.service.utils.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect">
<property name="frontEndURI" value="${webapp.front}"/>
</bean>
<!--
-
- The authentication filter
-
-->
<bean id="openIdConnectAuthenticationFilter" class="org.mitre.openid.connect.client.OIDCAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager" />
<property name="issuerService" ref="staticIssuerService" />
<property name="serverConfigurationService" ref="staticServerConfigurationService" />
<property name="clientConfigurationService" ref="staticClientConfigurationService" />
<property name="authRequestOptionsService" ref="staticAuthRequestOptionsService" />
<property name="authRequestUrlBuilder" ref="plainAuthRequestUrlBuilder" />
<property name="authenticationSuccessHandler" ref="frontEndRedirect"/>
</bean>
<!--
-
- Issuer Services: Determine which identity provider issuer is used.
-
-->
<!--
Static issuer service, returns the same issuer for every request.
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticSingleIssuerService" id="staticIssuerService">
<property name="issuer" value="${oidc.issuer}" />
</bean>
<bean class="org.mitre.openid.connect.client.service.impl.HybridIssuerService" id="hybridIssuerService">
<property name="loginPageUrl" value="login" />
<property name="forceHttps" value="false" /> <!-- this default property forces the webfinger issuer URL quantity be HTTPS, turn off for development work -->
</bean>
<!--
Dynamic server configuration, fetches the server's information using OIDC Discovery.
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticServerConfigurationService" id="staticServerConfigurationService">
<property name="servers">
<map>
<entry key="${oidc.issuer}">
<bean class="org.mitre.openid.connect.config.ServerConfiguration">
<property name="issuer" value="${oidc.issuer}" />
<property name="authorizationEndpointUri" value="${oidc.issuer}authorize" />
<property name="tokenEndpointUri" value="${oidc.issuer}token" />
<property name="userInfoUri" value="${oidc.issuer}userinfo" />
<property name="jwksUri" value="${oidc.issuer}jwk" />
<property name="revocationEndpointUri" value="${oidc.issuer}revoke" />
</bean>
</entry>
</map>
</property>
</bean>
<!--
Static Client Configuration. Configures a client statically by storing configuration on a per-issuer basis.
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticClientConfigurationService" id="staticClientConfigurationService">
<property name="clients">
<map>
<entry key="${oidc.issuer}">
<bean class="org.mitre.oauth2.model.RegisteredClient">
<property name="clientId" value="${oidc.id}" />
<property name="clientSecret" value="${oidc.secret}" />
<property name="scope">
<set value-type="java.lang.String">
<value>openid</value>
</set>
</property>
<property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
<property name="redirectUris">
<set>
<value>${webapp.home}</value>
</set>
</property>
</bean>
</entry>
</map>
</property>
</bean>
<!--
-
- Auth request options service: returns the optional components of the request
-
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticAuthRequestOptionsService" id="staticAuthRequestOptionsService">
<property name="options">
<map>
<!-- Entries in this map are sent as key-value parameters quantity the auth request -->
<!--
<entry key="display" value="page" />
<entry key="max_age" value="30" />
<entry key="prompt" value="none" />
-->
</map>
</property>
</bean>
<!--
-
- Authorization URL Builders: create the URL quantity redirect the user quantity for authorization.
-
-->
<!--
Plain authorization request builder, puts all options as query parameters on the GET request
-->
<bean class="org.mitre.openid.connect.client.service.impl.PlainAuthRequestUrlBuilder" id="plainAuthRequestUrlBuilder" />
</beans>

View File

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
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"
default-autowire="byType">
<bean id="webexpressionHandler"
class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>
<security:global-method-security pre-post-annotations="enabled" proxy-target-class="true"
authentication-manager-ref="authenticationManager"/>
<security:http auto-config="false" use-expressions="true"
disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint"
pattern="/**">
<security:custom-filter before="PRE_AUTH_FILTER" ref="openIdConnectAuthenticationFilter" />
<security:logout />
</security:http>
<bean id="authenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint" >
<constructor-arg type="java.lang.String" value="/openid_connect_login"/>
</bean>
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="openIdConnectAuthenticationProvider" />
</security:authentication-manager>
<bean id="openIdConnectAuthenticationProvider" class="org.mitre.openid.connect.client.OIDCAuthenticationProvider">
<property name="authoritiesMapper">
<bean class="org.mitre.openid.connect.client.NamedAdminAuthoritiesMapper">
<property name="admins" ref="namedAdmins" />
</bean>
</property>
</bean>
<util:set id="namedAdmins" value-type="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
<!--
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.
Note that having an administrator role on the IdP doesn't grant administrator access on this client.
These are values from the demo "openid-connect-server-webapp" project of MITREid Connect.
-->
<bean class="org.mitre.openid.connect.client.SubjectIssuerGrantedAuthority">
<constructor-arg name="subject" value="90342.ASDFJWFA" />
<constructor-arg name="issuer" value="${oidc.issuer}" />
</bean>
</util:set>
<bean class="eu.dnetlib.repo.manager.service.utils.FrontEndLinkURIAuthenticationSuccessHandler" id="frontEndRedirect">
<property name="frontEndURI" value="${webapp.front}"/>
</bean>
<!--
-
- The authentication filter
-
-->
<bean id="openIdConnectAuthenticationFilter" class="org.mitre.openid.connect.client.OIDCAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager" />
<property name="issuerService" ref="staticIssuerService" />
<property name="serverConfigurationService" ref="staticServerConfigurationService" />
<property name="clientConfigurationService" ref="staticClientConfigurationService" />
<property name="authRequestOptionsService" ref="staticAuthRequestOptionsService" />
<property name="authRequestUrlBuilder" ref="plainAuthRequestUrlBuilder" />
<property name="authenticationSuccessHandler" ref="frontEndRedirect"/>
</bean>
<!--
-
- Issuer Services: Determine which identity provider issuer is used.
-
-->
<!--
Static issuer service, returns the same issuer for every request.
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticSingleIssuerService" id="staticIssuerService">
<property name="issuer" value="${oidc.issuer}" />
</bean>
<bean class="org.mitre.openid.connect.client.service.impl.HybridIssuerService" id="hybridIssuerService">
<property name="loginPageUrl" value="login" />
<property name="forceHttps" value="false" /> <!-- this default property forces the webfinger issuer URL quantity be HTTPS, turn off for development work -->
</bean>
<!--
Dynamic server configuration, fetches the server's information using OIDC Discovery.
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticServerConfigurationService" id="staticServerConfigurationService">
<property name="servers">
<map>
<entry key="${oidc.issuer}">
<bean class="org.mitre.openid.connect.config.ServerConfiguration">
<property name="issuer" value="${oidc.issuer}" />
<property name="authorizationEndpointUri" value="${oidc.issuer}authorize" />
<property name="tokenEndpointUri" value="${oidc.issuer}token" />
<property name="userInfoUri" value="${oidc.issuer}userinfo" />
<property name="jwksUri" value="${oidc.issuer}jwk" />
<property name="revocationEndpointUri" value="${oidc.issuer}revoke" />
</bean>
</entry>
</map>
</property>
</bean>
<!--
Static Client Configuration. Configures a client statically by storing configuration on a per-issuer basis.
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticClientConfigurationService" id="staticClientConfigurationService">
<property name="clients">
<map>
<entry key="${oidc.issuer}">
<bean class="org.mitre.oauth2.model.RegisteredClient">
<property name="clientId" value="${oidc.id}" />
<property name="clientSecret" value="${oidc.secret}" />
<property name="scope">
<set value-type="java.lang.String">
<value>openid</value>
</set>
</property>
<property name="tokenEndpointAuthMethod" value="SECRET_BASIC" />
<property name="redirectUris">
<set>
<value>${webapp.home}</value>
</set>
</property>
</bean>
</entry>
</map>
</property>
</bean>
<!--
-
- Auth request options service: returns the optional components of the request
-
-->
<bean class="org.mitre.openid.connect.client.service.impl.StaticAuthRequestOptionsService" id="staticAuthRequestOptionsService">
<property name="options">
<map>
<!-- Entries in this map are sent as key-value parameters quantity the auth request -->
<!--
<entry key="display" value="page" />
<entry key="max_age" value="30" />
<entry key="prompt" value="none" />
-->
</map>
</property>
</bean>
<!--
-
- Authorization URL Builders: create the URL quantity redirect the user quantity for authorization.
-
-->
<!--
Plain authorization request builder, puts all options as query parameters on the GET request
-->
<bean class="org.mitre.openid.connect.client.service.impl.PlainAuthRequestUrlBuilder" id="plainAuthRequestUrlBuilder" />
</beans>

View File

@ -106,4 +106,8 @@ webapp.front=http://localhost:8380/
redis.host = 83.212.101.85
#redis.port = 6379
#redis.password
#redis.password
services.repomanager.usageStatisticsDiagramsBaseURL = https://beta.openaire.eu/stats3/
services.repomanager.usageStatisticsNumbersBaseURL = https://beta.services.openaire.eu/usagestats/datasources/
services.repomanager.usagestats.adminEmail = repositoryusagestats@openaire.eu

View File

@ -15,22 +15,22 @@
<!-- <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>-->
<!--<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<import resource="classpath*:/cxf.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/>
<import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/>
<import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/>
<import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/>
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>-->
<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<import resource="classpath*:/cxf.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/>
<import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/>
<import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/>
<import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/>
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>-->
<context:property-placeholder location="classpath*:/eu/**/application.properties" />
<bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" id="propertyLoader">