develop #1
|
@ -1,58 +0,0 @@
|
||||||
# This script can create the local "dnet-repository" and copy the "settings-dnet.xml" file there.
|
|
||||||
# It also builds the project, using the aforementioned settings file.
|
|
||||||
# Then it can run the project locally.
|
|
||||||
# By giving different options, the user can either install and run locally, just install (arg: 2) or just run (arg: 1) the project.
|
|
||||||
|
|
||||||
|
|
||||||
# For error-handling, we cannot use the "set -e" since: it has problems https://mywiki.wooledge.org/BashFAQ/105
|
|
||||||
# So we have our own function, for use when a single command fails.
|
|
||||||
handle_error () {
|
|
||||||
echo -e "$1"; exit $2
|
|
||||||
}
|
|
||||||
|
|
||||||
# Change the working directory to the script's directory, when running from another location.
|
|
||||||
cd "${0%/*}" || handle_error "Could not change-dir to this script's dir!" 1
|
|
||||||
|
|
||||||
if [[ $# -gt 1 ]]; then
|
|
||||||
echo -e "Wrong number of arguments given: ${#}\nPlease execute it like: installAndRun.sh <1 | 2 | 0 (optional)> "; exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
justOneTask=0
|
|
||||||
|
|
||||||
if [[ $# -eq 1 ]]; then # If we have just 1 argument.
|
|
||||||
numbers_re='^[0-9]+$'
|
|
||||||
if ! [[ $1 =~ $numbers_re ]]; then # If the first argument is not numeric.
|
|
||||||
echo -e "Invalid, non-numeric argument given: ${1}\nPlease execute it like: installAndRun.sh <1 | 2 | 0 (optional)>"; exit 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $1 -lt 0 || $1 -gt 2 ]]; then # If the 1st argument does NOT equal to < 0 >, < 1 > or < 2 >.
|
|
||||||
echo -e "Invalid argument given: ${1}\nPlease execute it like: installAndRun.sh <1 | 2 | 0 (optional)>"; exit 4
|
|
||||||
fi
|
|
||||||
|
|
||||||
justOneTask=$1 # Assign <1>, <2> or <0>
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnet_repo=~/.m2/repository-dnet45
|
|
||||||
settings_file=settings-dnet45.xml
|
|
||||||
|
|
||||||
if [[ justOneTask -eq 1 ]]; then
|
|
||||||
if [ ! -f ${dnet_repo}"/"${settings_file} ]; then
|
|
||||||
echo -e "The file \"${dnet_repo}/${settings_file}\" does not exist! Exiting.."; exit 5
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ ! -d ${dnet_repo} ]; then
|
|
||||||
mkdir ${dnet_repo} || exit 6
|
|
||||||
echo "Created the \"dnet_repo\": ${dnet_repo}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f ${dnet_repo}"/"${settings_file} ]; then
|
|
||||||
cp ${settings_file} ${dnet_repo}"/"${settings_file} || handle_error "The file \"${settings_file}\" could not be copied in directory \"${dnet_repo}\"! Exiting.." 7
|
|
||||||
echo "Copied the \"settings_file\" to: ${dnet_repo}/${settings_file}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mvn clean install -s ${dnet_repo}"/"${settings_file} || handle_error "The project could not be built. Exiting.." 8
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ justOneTask -ne 2 ]]; then # If we do NOT want to "justInstall".
|
|
||||||
java -jar ./target/uoa-repository-manager-service.jar || handle_error "The project failed to execute or its execution was interrupted. Exiting.." 9
|
|
||||||
fi
|
|
136
pom.xml
136
pom.xml
|
@ -22,7 +22,7 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -30,15 +30,10 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jdbc</artifactId>
|
<artifactId>spring-boot-starter-data-jdbc</artifactId>
|
||||||
|
@ -47,11 +42,6 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
|
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
|
||||||
<!--<scope>provided</scope>-->
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
@ -60,20 +50,7 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
|
||||||
<version>3.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.el</groupId>
|
|
||||||
<artifactId>javax.el-api</artifactId>
|
|
||||||
<version>3.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>eu.dnetlib.dhp</groupId>
|
<groupId>eu.dnetlib.dhp</groupId>
|
||||||
|
@ -123,36 +100,6 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework</groupId>-->
|
|
||||||
<!-- <artifactId>spring-webmvc</artifactId>-->
|
|
||||||
<!-- <version>${spring.version}</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.hibernate</groupId>-->
|
|
||||||
<!-- <artifactId>hibernate-validator-annotation-processor</artifactId>-->
|
|
||||||
<!-- <version>4.1.0.Final</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>log4j</groupId>-->
|
|
||||||
<!-- <artifactId>log4j</artifactId>-->
|
|
||||||
<!-- <version>${log4j.version}</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>eu.dnetlib</groupId>-->
|
|
||||||
<!-- <artifactId>uoa-domain</artifactId>-->
|
|
||||||
<!-- <version>[2.0.0-SNAPSHOT, 3.0.0)</version>-->
|
|
||||||
<!-- <exclusions>-->
|
|
||||||
<!-- <exclusion> <!– declare the exclusion here –>-->
|
|
||||||
<!-- <groupId>cglib</groupId>-->
|
|
||||||
<!-- <artifactId>cglib</artifactId>-->
|
|
||||||
<!-- </exclusion>-->
|
|
||||||
<!-- <exclusion>-->
|
|
||||||
<!-- <groupId>log4j</groupId>-->
|
|
||||||
<!-- <artifactId>log4j</artifactId>-->
|
|
||||||
<!-- </exclusion>-->
|
|
||||||
<!-- </exclusions>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>eu.dnetlib</groupId>
|
<groupId>eu.dnetlib</groupId>
|
||||||
<artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
|
<artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
|
||||||
|
@ -192,38 +139,6 @@
|
||||||
<version>2.7.2</version>
|
<version>2.7.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>xerces</groupId>-->
|
|
||||||
<!-- <artifactId>xercesImpl</artifactId>-->
|
|
||||||
<!-- <version>2.11.0</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-core</artifactId>
|
|
||||||
<version>2.9.4</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<version>2.9.4</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework</groupId>-->
|
|
||||||
<!-- <artifactId>spring-context</artifactId>-->
|
|
||||||
<!-- <version>${spring.version}</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework</groupId>-->
|
|
||||||
<!-- <artifactId>spring-jdbc</artifactId>-->
|
|
||||||
<!-- <version>${spring.version}</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.jersey</groupId>
|
<groupId>com.sun.jersey</groupId>
|
||||||
<artifactId>jersey-client</artifactId>
|
<artifactId>jersey-client</artifactId>
|
||||||
|
@ -265,13 +180,6 @@
|
||||||
<version>9.1-901.jdbc3</version>
|
<version>9.1-901.jdbc3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina -->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.apache.tomcat</groupId>-->
|
|
||||||
<!-- <artifactId>tomcat-catalina</artifactId>-->
|
|
||||||
<!-- <version>9.0.22</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-fileupload</groupId>
|
<groupId>commons-fileupload</groupId>
|
||||||
<artifactId>commons-fileupload</artifactId>
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
@ -293,14 +201,6 @@
|
||||||
<groupId>org.springframework.session</groupId>
|
<groupId>org.springframework.session</groupId>
|
||||||
<artifactId>spring-session-data-redis</artifactId>
|
<artifactId>spring-session-data-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.session</groupId>
|
|
||||||
<artifactId>spring-session-data-redis</artifactId>
|
|
||||||
<version>2.5.1</version>
|
|
||||||
<type>pom</type>
|
|
||||||
</dependency>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
|
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -324,13 +224,7 @@
|
||||||
<artifactId>cors-filter</artifactId>
|
<artifactId>cors-filter</artifactId>
|
||||||
<version>2.5</version>
|
<version>2.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.netflix.rxjava</groupId>
|
|
||||||
<artifactId>rxjava-core</artifactId>
|
|
||||||
<version>0.20.7</version>
|
|
||||||
</dependency>
|
|
||||||
-->
|
|
||||||
<!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
|
<!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.xml.ws</groupId>
|
<groupId>javax.xml.ws</groupId>
|
||||||
|
@ -384,30 +278,6 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Enable micrometer >> -->
|
|
||||||
<!-- <dependency> <!– TODO: remove this with ActuatorConfig class –>-->
|
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
|
||||||
<!-- <artifactId>spring-boot-actuator</artifactId>-->
|
|
||||||
<!-- <version>1.3.5.RELEASE</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
|
||||||
<!-- <artifactId>spring-boot-actuator-autoconfigure</artifactId>-->
|
|
||||||
<!-- <version>2.1.18.RELEASE</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>io.micrometer</groupId>-->
|
|
||||||
<!-- <artifactId>micrometer-core</artifactId>-->
|
|
||||||
<!-- <version>1.7.2</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.micrometer</groupId>
|
|
||||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
|
||||||
<version>1.7.2</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<!-- << Enable micrometer -->
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
|
|
||||||
<localRepository>${env.HOME}/.m2/repository-dnet45</localRepository>
|
|
||||||
<pluginGroups>
|
|
||||||
<pluginGroup>org.apache.tomcat.maven</pluginGroup>
|
|
||||||
</pluginGroups>
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>dnet4.0</id>
|
|
||||||
<activation>
|
|
||||||
<activeByDefault>true</activeByDefault>
|
|
||||||
</activation>
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>dnet45-bootstrap-snapshot</id>
|
|
||||||
<name>D-Net 45 Bootstrap Snapshot</name>
|
|
||||||
<url>https://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-bootstrap-snapshot</url>
|
|
||||||
<releases>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</releases>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
<layout>default</layout>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>dnet45-bootstrap-release</id>
|
|
||||||
<name>D-Net 45 Bootstrap Release</name>
|
|
||||||
<url>https://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-bootstrap-release</url>
|
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</releases>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</snapshots>
|
|
||||||
<layout>default</layout>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
</settings>
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.dnetlib.repo.manager.config;
|
package eu.dnetlib.repo.manager.config;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||||
|
@ -15,7 +16,7 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
||||||
@Override
|
@Override
|
||||||
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
|
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
|
||||||
return new AsyncUncaughtExceptionHandler() {
|
return new AsyncUncaughtExceptionHandler() {
|
||||||
private final Logger logger = Logger.getLogger(getClass());
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleUncaughtException(Throwable throwable, Method method, Object... objects) {
|
public void handleUncaughtException(Throwable throwable, Method method, Object... objects) {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package eu.dnetlib.repo.manager.config;
|
package eu.dnetlib.repo.manager.config;
|
||||||
|
|
||||||
import org.apache.commons.dbcp.BasicDataSource;
|
import org.apache.commons.dbcp.BasicDataSource;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -12,7 +13,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
public class DatasourceConfiguration {
|
public class DatasourceConfiguration {
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(DatasourceConfiguration.class);
|
private static Logger logger = LoggerFactory.getLogger(DatasourceConfiguration.class);
|
||||||
|
|
||||||
@Value("${services.provide.db.driverClassName}")
|
@Value("${services.provide.db.driverClassName}")
|
||||||
private String driverClassname;
|
private String driverClassname;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package eu.dnetlib.repo.manager.config;
|
package eu.dnetlib.repo.manager.config;
|
||||||
|
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||||
|
@ -22,10 +23,10 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati
|
||||||
|
|
||||||
private String frontEndURI;
|
private String frontEndURI;
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(FrontEndLinkURIAuthenticationSuccessHandler.class);
|
private static final Logger logger = LoggerFactory.getLogger(FrontEndLinkURIAuthenticationSuccessHandler.class);
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
logger.debug("Front end uri : " + frontEndURI);
|
logger.debug("Front end uri : {}", frontEndURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
|
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
|
||||||
OIDCAuthenticationToken authOIDC = (OIDCAuthenticationToken) authentication;
|
OIDCAuthenticationToken authOIDC = (OIDCAuthenticationToken) authentication;
|
||||||
request.getSession().setAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, authOIDC.getUserInfo().getEmail());
|
request.getSession().setAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, authOIDC.getUserInfo().getSub());
|
||||||
|
|
||||||
Cookie accessToken = new Cookie("AccessToken", authOIDC.getAccessTokenValue());
|
Cookie accessToken = new Cookie("AccessToken", authOIDC.getAccessTokenValue());
|
||||||
Matcher matcher = AUTH_REGEX.matcher(authOIDC.getAccessTokenValue());
|
Matcher matcher = AUTH_REGEX.matcher(authOIDC.getAccessTokenValue());
|
||||||
|
|
|
@ -3,9 +3,10 @@ package eu.dnetlib.repo.manager.config;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.nimbusds.jwt.JWT;
|
import com.nimbusds.jwt.JWT;
|
||||||
import eu.dnetlib.repo.manager.service.security.AuthoritiesMapper;
|
import eu.dnetlib.repo.manager.service.security.AuthoritiesMapper;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.mitre.openid.connect.client.OIDCAuthoritiesMapper;
|
import org.mitre.openid.connect.client.OIDCAuthoritiesMapper;
|
||||||
import org.mitre.openid.connect.model.UserInfo;
|
import org.mitre.openid.connect.model.UserInfo;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
@ -18,7 +19,7 @@ import java.util.Set;
|
||||||
@Component
|
@Component
|
||||||
public class OpenAIREAuthoritiesMapper implements OIDCAuthoritiesMapper {
|
public class OpenAIREAuthoritiesMapper implements OIDCAuthoritiesMapper {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(OpenAIREAuthoritiesMapper.class);
|
private static final Logger logger = LoggerFactory.getLogger(OpenAIREAuthoritiesMapper.class);
|
||||||
|
|
||||||
@Value("${services.provide.adminEmail}")
|
@Value("${services.provide.adminEmail}")
|
||||||
String adminEmail;
|
String adminEmail;
|
||||||
|
@ -33,7 +34,7 @@ public class OpenAIREAuthoritiesMapper implements OIDCAuthoritiesMapper {
|
||||||
} else if (userInfo.getSource().getAsJsonArray("eduperson_entitlement") != null) {
|
} else if (userInfo.getSource().getAsJsonArray("eduperson_entitlement") != null) {
|
||||||
entitlements = userInfo.getSource().getAsJsonArray("eduperson_entitlement");
|
entitlements = userInfo.getSource().getAsJsonArray("eduperson_entitlement");
|
||||||
}
|
}
|
||||||
logger.debug("user info: " + userInfo + "\nentitlements: " + entitlements);
|
logger.debug("user info: {}\nentitlements: {}", userInfo, entitlements);
|
||||||
|
|
||||||
// FIXME: delete this if statement when super administrators are set
|
// FIXME: delete this if statement when super administrators are set
|
||||||
if (userInfo.getEmail() != null && userInfo.getEmail().equals(adminEmail)) {
|
if (userInfo.getEmail() != null && userInfo.getEmail().equals(adminEmail)) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.dnetlib.repo.manager.config;
|
package eu.dnetlib.repo.manager.config;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -15,7 +16,7 @@ import javax.annotation.PostConstruct;
|
||||||
@EnableRedisHttpSession
|
@EnableRedisHttpSession
|
||||||
public class RedisConfiguration {
|
public class RedisConfiguration {
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(RedisConfiguration.class);
|
private static final Logger logger = LoggerFactory.getLogger(RedisConfiguration.class);
|
||||||
|
|
||||||
@Value("${services.provide.redis.host}")
|
@Value("${services.provide.redis.host}")
|
||||||
private String host;
|
private String host;
|
||||||
|
@ -51,7 +52,7 @@ public class RedisConfiguration {
|
||||||
serializer.setCookieName("openAIRESession");
|
serializer.setCookieName("openAIRESession");
|
||||||
serializer.setCookiePath("/");
|
serializer.setCookiePath("/");
|
||||||
serializer.setDomainName(domain);
|
serializer.setDomainName(domain);
|
||||||
logger.info("Serializer : " + serializer);
|
logger.info("Cookie Serializer : {}", serializer);
|
||||||
return serializer;
|
return serializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
import eu.dnetlib.repo.manager.exception.EndPointException;
|
import eu.dnetlib.repo.manager.exception.EndPointException;
|
||||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||||
import eu.dnetlib.repo.manager.exception.ServerError;
|
import eu.dnetlib.repo.manager.exception.ServerError;
|
||||||
import org.apache.log4j.LogManager;
|
import org.slf4j.Logger;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
@ -26,7 +26,7 @@ import java.net.UnknownHostException;
|
||||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||||
public class GenericControllerAdvice {
|
public class GenericControllerAdvice {
|
||||||
|
|
||||||
private Logger logger = LogManager.getLogger(GenericControllerAdvice.class);
|
private Logger logger = LoggerFactory.getLogger(GenericControllerAdvice.class);
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.NOT_FOUND)
|
@ResponseStatus(HttpStatus.NOT_FOUND)
|
||||||
|
|
|
@ -6,9 +6,10 @@ import eu.dnetlib.repo.manager.domain.JobsOfUser;
|
||||||
import eu.dnetlib.repo.manager.service.MonitorServiceImpl;
|
import eu.dnetlib.repo.manager.service.MonitorServiceImpl;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
@ -20,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
@Api(description = "Monitor API", tags = {"monitor"})
|
@Api(description = "Monitor API", tags = {"monitor"})
|
||||||
public class MonitorController {
|
public class MonitorController {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(MonitorController.class);
|
private static final Logger logger = LoggerFactory.getLogger(MonitorController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MonitorServiceImpl monitorService;
|
private MonitorServiceImpl monitorService;
|
||||||
|
|
|
@ -9,7 +9,8 @@ import eu.dnetlib.repo.manager.service.PiWikServiceImpl;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
import org.springframework.core.io.FileSystemResource;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
@ -33,7 +34,7 @@ import java.util.List;
|
||||||
@Api(description = "Piwik API", tags = {"piwik"})
|
@Api(description = "Piwik API", tags = {"piwik"})
|
||||||
public class PiWikController {
|
public class PiWikController {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(PiWikController.class);
|
private static final Logger logger = LoggerFactory.getLogger(PiWikController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PiWikServiceImpl piWikService;
|
private PiWikServiceImpl piWikService;
|
||||||
|
|
|
@ -11,7 +11,8 @@ import io.micrometer.core.instrument.binder.system.UptimeMetrics;
|
||||||
import io.micrometer.prometheus.PrometheusConfig;
|
import io.micrometer.prometheus.PrometheusConfig;
|
||||||
import io.micrometer.prometheus.PrometheusMeterRegistry;
|
import io.micrometer.prometheus.PrometheusMeterRegistry;
|
||||||
import io.prometheus.client.exporter.common.TextFormat;
|
import io.prometheus.client.exporter.common.TextFormat;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -24,7 +25,7 @@ import java.io.File;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/actuator/prometheus")
|
@RequestMapping("/actuator/prometheus")
|
||||||
public class PrometheusController { // TODO: remove this with migration to Spring Boot 2
|
public class PrometheusController { // TODO: remove this with migration to Spring Boot 2
|
||||||
private static final Logger logger = Logger.getLogger(PrometheusController.class);
|
private static final Logger logger = LoggerFactory.getLogger(PrometheusController.class);
|
||||||
|
|
||||||
private final PiWikService piWikService;
|
private final PiWikService piWikService;
|
||||||
private final RepositoryService repositoryService;
|
private final RepositoryService repositoryService;
|
||||||
|
|
|
@ -11,9 +11,10 @@ import eu.dnetlib.repo.manager.service.RepositoryService;
|
||||||
import eu.dnetlib.repo.manager.service.security.AuthorizationService;
|
import eu.dnetlib.repo.manager.service.security.AuthorizationService;
|
||||||
import eu.dnetlib.repo.manager.utils.JsonUtils;
|
import eu.dnetlib.repo.manager.utils.JsonUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
@ -35,7 +36,7 @@ import java.util.Map;
|
||||||
@Api(description = "Repository API", tags = {"repositories"})
|
@Api(description = "Repository API", tags = {"repositories"})
|
||||||
public class RepositoryController {
|
public class RepositoryController {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(RepositoryController.class);
|
private static final Logger logger = LoggerFactory.getLogger(RepositoryController.class);
|
||||||
|
|
||||||
private final RepositoryService repositoryService;
|
private final RepositoryService repositoryService;
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class UserRoleController {
|
||||||
@RequestMapping(method = RequestMethod.GET, path = "/users/{email}/roles")
|
@RequestMapping(method = RequestMethod.GET, path = "/users/{email}/roles")
|
||||||
@PreAuthorize("hasAnyAuthority('SUPER_ADMINISTRATOR', 'CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or hasAuthority('REGISTERED_USER') and authentication.userInfo.email==#email")
|
@PreAuthorize("hasAnyAuthority('SUPER_ADMINISTRATOR', 'CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or hasAuthority('REGISTERED_USER') and authentication.userInfo.email==#email")
|
||||||
public ResponseEntity<Collection<String>> getRolesByEmail(@PathVariable("email") String email) {
|
public ResponseEntity<Collection<String>> getRolesByEmail(@PathVariable("email") String email) {
|
||||||
return ResponseEntity.ok(authorizationService.getUserRoles(email));
|
return ResponseEntity.ok(authorizationService.getUserRolesByEmail(email));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@ package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
|
import eu.dnetlib.enabling.datasources.common.AggregationInfo;
|
||||||
import eu.dnetlib.repo.manager.domain.AggregationHistoryResponse;
|
import eu.dnetlib.repo.manager.domain.AggregationHistoryResponse;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
@ -20,7 +21,7 @@ import static eu.dnetlib.repo.manager.utils.DateUtils.getYear;
|
||||||
@Service("aggregationService")
|
@Service("aggregationService")
|
||||||
public class AggregationServiceImpl implements AggregationService {
|
public class AggregationServiceImpl implements AggregationService {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(AggregationServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(AggregationServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
@Value("${services.provide.clients.dsm}")
|
@Value("${services.provide.clients.dsm}")
|
||||||
|
|
|
@ -9,6 +9,8 @@ import eu.dnetlib.repo.manager.domain.broker.*;
|
||||||
import eu.dnetlib.repo.manager.exception.BrokerException;
|
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
import org.apache.commons.lang.NotImplementedException;
|
import org.apache.commons.lang.NotImplementedException;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
|
@ -43,7 +45,7 @@ public class BrokerServiceImpl implements BrokerService {
|
||||||
@Value("${services.provide.topic_types.url}")
|
@Value("${services.provide.topic_types.url}")
|
||||||
private String topicsURL;
|
private String topicsURL;
|
||||||
|
|
||||||
private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(BrokerServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(BrokerServiceImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RestTemplate restTemplate;
|
RestTemplate restTemplate;
|
||||||
|
@ -210,7 +212,7 @@ public class BrokerServiceImpl implements BrokerService {
|
||||||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service)
|
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service)
|
||||||
.queryParam("email", userEmail);
|
.queryParam("email", userEmail);
|
||||||
|
|
||||||
logger.debug(builder.build().encode().toUri());
|
logger.debug("{}", builder.build().encode().toUri());
|
||||||
ResponseEntity<Map<String, List<SimpleSubscriptionDesc>>> resp;
|
ResponseEntity<Map<String, List<SimpleSubscriptionDesc>>> resp;
|
||||||
try {
|
try {
|
||||||
resp = restTemplate.exchange(
|
resp = restTemplate.exchange(
|
||||||
|
|
|
@ -8,7 +8,8 @@ import eu.dnetlib.repo.manager.domain.broker.BrowseEntry;
|
||||||
import eu.dnetlib.repo.manager.exception.BrokerException;
|
import eu.dnetlib.repo.manager.exception.BrokerException;
|
||||||
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import eu.dnetlib.repo.manager.utils.DateUtils;
|
import eu.dnetlib.repo.manager.utils.DateUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ import java.util.List;
|
||||||
@Service("dashboardService")
|
@Service("dashboardService")
|
||||||
public class DashboardServiceImpl implements DashboardService {
|
public class DashboardServiceImpl implements DashboardService {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(DashboardServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(DashboardServiceImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RepositoryService repositoryService;
|
private RepositoryService repositoryService;
|
||||||
|
|
|
@ -6,8 +6,9 @@ import eu.dnetlib.repo.manager.domain.Repository;
|
||||||
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
import eu.dnetlib.repo.manager.domain.RepositoryInterface;
|
||||||
import eu.dnetlib.repo.manager.exception.ValidationServiceException;
|
import eu.dnetlib.repo.manager.exception.ValidationServiceException;
|
||||||
import eu.dnetlib.utils.MailLibrary;
|
import eu.dnetlib.utils.MailLibrary;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
|
@ -21,7 +22,7 @@ import java.util.stream.Collectors;
|
||||||
@Component("emailUtils")
|
@Component("emailUtils")
|
||||||
public class EmailUtilsImpl implements EmailUtils {
|
public class EmailUtilsImpl implements EmailUtils {
|
||||||
|
|
||||||
private final static Logger logger = Logger.getLogger(EmailUtilsImpl.class);
|
private final static Logger logger = LoggerFactory.getLogger(EmailUtilsImpl.class);
|
||||||
|
|
||||||
private final MailLibrary mailLibrary;
|
private final MailLibrary mailLibrary;
|
||||||
private final RepositoryService repositoryService;
|
private final RepositoryService repositoryService;
|
||||||
|
|
|
@ -7,10 +7,11 @@ import eu.dnetlib.repo.manager.domain.Constants;
|
||||||
import eu.dnetlib.repo.manager.domain.JobsOfUser;
|
import eu.dnetlib.repo.manager.domain.JobsOfUser;
|
||||||
import eu.dnetlib.repo.manager.utils.CrisValidatorUtils;
|
import eu.dnetlib.repo.manager.utils.CrisValidatorUtils;
|
||||||
import gr.uoa.di.driver.util.ServiceLocator;
|
import gr.uoa.di.driver.util.ServiceLocator;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.eurocris.openaire.cris.validator.model.Job;
|
import org.eurocris.openaire.cris.validator.model.Job;
|
||||||
import org.eurocris.openaire.cris.validator.service.MapJobDao;
|
import org.eurocris.openaire.cris.validator.service.MapJobDao;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ import java.util.stream.Collectors;
|
||||||
@Service("monitorService")
|
@Service("monitorService")
|
||||||
public class MonitorServiceImpl implements MonitorService {
|
public class MonitorServiceImpl implements MonitorService {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(MonitorServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(MonitorServiceImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MapJobDao crisJobs;
|
private MapJobDao crisJobs;
|
||||||
|
@ -53,9 +54,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||||
String validationStatus,
|
String validationStatus,
|
||||||
String includeJobsTotal) throws JSONException, ValidatorServiceException {
|
String includeJobsTotal) throws JSONException, ValidatorServiceException {
|
||||||
|
|
||||||
logger.debug("Getting jobs of user : " + user
|
|
||||||
+ "\n" + user + "/" + jobType + "/" + offset + "/" + dateFrom + "/" + dateTo + "/" + validationStatus + "/" + includeJobsTotal);
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -162,7 +160,7 @@ public class MonitorServiceImpl implements MonitorService {
|
||||||
try {
|
try {
|
||||||
return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
|
return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
|
||||||
} catch (ValidatorServiceException e) {
|
} catch (ValidatorServiceException e) {
|
||||||
logger.error(e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +173,7 @@ public class MonitorServiceImpl implements MonitorService {
|
||||||
try {
|
try {
|
||||||
job = getValidationService().getStoredJob(Integer.parseInt(jobId), groupBy);
|
job = getValidationService().getStoredJob(Integer.parseInt(jobId), groupBy);
|
||||||
} catch (ValidatorServiceException e) {
|
} catch (ValidatorServiceException e) {
|
||||||
logger.error(e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
||||||
|
|
|
@ -7,7 +7,8 @@ import eu.dnetlib.repo.manager.domain.OrderByType;
|
||||||
import eu.dnetlib.repo.manager.domain.Repository;
|
import eu.dnetlib.repo.manager.domain.Repository;
|
||||||
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
import eu.dnetlib.repo.manager.exception.RepositoryServiceException;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
@ -32,7 +33,7 @@ import java.util.Map;
|
||||||
@Service("piwikService")
|
@Service("piwikService")
|
||||||
public class PiWikServiceImpl implements PiWikService {
|
public class PiWikServiceImpl implements PiWikService {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(PiWikServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(PiWikServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -51,17 +52,19 @@ public class PiWikServiceImpl implements PiWikService {
|
||||||
private EmailUtils emailUtils;
|
private EmailUtils emailUtils;
|
||||||
|
|
||||||
|
|
||||||
private final static String GET_PIWIK_SITE = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site where repositoryid = ?;";
|
private static final String GET_PIWIK_SITE = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site where repositoryid = ?;";
|
||||||
|
|
||||||
private final static String INSERT_PIWIK_INFO = "insert into piwik_site (repositoryid, siteid, creationdate, requestorname, requestoremail, validated, repositoryname, country, authenticationtoken) values (?, ?, now(), ?, ?, ?, ?, ?, ?)";
|
private static final String INSERT_PIWIK_INFO = "insert into piwik_site (repositoryid, siteid, creationdate, requestorname, requestoremail, validated, repositoryname, country, authenticationtoken) values (?, ?, now(), ?, ?, ?, ?, ?, ?)";
|
||||||
|
|
||||||
private final static String GET_PIWIK_SITES = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site ";
|
private static final String UPDATE_PIWIK_INFO = "update piwik_site set siteid = ?, creationdate = now(), requestorname = ?, requestoremail = ?, validated = ?, repositoryname = ?, country = ?, authenticationtoken = ? where repositoryid = ?";
|
||||||
|
|
||||||
private final static String GET_PIWIK_SITES_TOTAL = "select count(*) as totals from piwik_site ";
|
private static final String GET_PIWIK_SITES = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site ";
|
||||||
|
|
||||||
private final static String APPROVE_PIWIK_SITE = "update piwik_site set validated=true, validationdate=now() where repositoryid = ?;";
|
private static final String GET_PIWIK_SITES_TOTAL = "select count(*) as totals from piwik_site ";
|
||||||
|
|
||||||
private RowMapper<PiwikInfo> piwikRowMapper = (rs, i) -> new PiwikInfo(rs.getString("repositoryid"), getOpenaireId(rs.getString("repositoryid")), rs.getString("repositoryname"), rs.getString("country"),
|
private static final String APPROVE_PIWIK_SITE = "update piwik_site set validated=true, validationdate=now() where repositoryid = ?;";
|
||||||
|
|
||||||
|
private final RowMapper<PiwikInfo> piwikRowMapper = (rs, i) -> new PiwikInfo(rs.getString("repositoryid"), getOpenaireId(rs.getString("repositoryid")), rs.getString("repositoryname"), rs.getString("country"),
|
||||||
rs.getString("siteid"), rs.getString("authenticationtoken"), rs.getTimestamp("creationdate"), rs.getString("requestorname"), rs.getString("requestoremail"),
|
rs.getString("siteid"), rs.getString("authenticationtoken"), rs.getTimestamp("creationdate"), rs.getString("requestorname"), rs.getString("requestoremail"),
|
||||||
rs.getBoolean("validated"), rs.getTimestamp("validationdate"), rs.getString("comment"));
|
rs.getBoolean("validated"), rs.getTimestamp("validationdate"), rs.getString("comment"));
|
||||||
|
|
||||||
|
@ -79,9 +82,15 @@ public class PiWikServiceImpl implements PiWikService {
|
||||||
@PreAuthorize("hasAuthority('SUPER_ADMINISTRATOR') or hasAuthority('CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or (hasAuthority('REGISTERED_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)")
|
@PreAuthorize("hasAuthority('SUPER_ADMINISTRATOR') or hasAuthority('CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or (hasAuthority('REGISTERED_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)")
|
||||||
public PiwikInfo savePiwikInfo(PiwikInfo piwikInfo) {
|
public PiwikInfo savePiwikInfo(PiwikInfo piwikInfo) {
|
||||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(),
|
if (getPiwikSiteForRepo(piwikInfo.getRepositoryId()) == null) {
|
||||||
piwikInfo.getRequestorEmail(), piwikInfo.isValidated(), piwikInfo.getRepositoryName(), piwikInfo.getCountry(), piwikInfo.getAuthenticationToken()},
|
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(),
|
||||||
new int[]{Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BOOLEAN, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR});
|
piwikInfo.getRequestorEmail(), piwikInfo.isValidated(), piwikInfo.getRepositoryName(), piwikInfo.getCountry(), piwikInfo.getAuthenticationToken()},
|
||||||
|
new int[]{Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BOOLEAN, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR});
|
||||||
|
} else {
|
||||||
|
jdbcTemplate.update(UPDATE_PIWIK_INFO, new Object[]{piwikInfo.getSiteId(), piwikInfo.getRequestorName(), piwikInfo.getRequestorEmail(),
|
||||||
|
piwikInfo.isValidated(), piwikInfo.getRepositoryName(), piwikInfo.getCountry(), piwikInfo.getAuthenticationToken(), piwikInfo.getRepositoryId()},
|
||||||
|
new int[]{Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BOOLEAN, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR});
|
||||||
|
}
|
||||||
return piwikInfo;
|
return piwikInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,12 @@ import eu.dnetlib.repo.manager.utils.Converter;
|
||||||
import eu.dnetlib.repo.manager.utils.DateUtils;
|
import eu.dnetlib.repo.manager.utils.DateUtils;
|
||||||
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
|
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
@ -49,7 +50,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
@Service("repositoryService")
|
@Service("repositoryService")
|
||||||
public class RepositoryServiceImpl implements RepositoryService {
|
public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(RepositoryServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(RepositoryServiceImpl.class);
|
||||||
|
|
||||||
private final AuthorizationService authorizationService;
|
private final AuthorizationService authorizationService;
|
||||||
private final RoleMappingService roleMappingService;
|
private final RoleMappingService roleMappingService;
|
||||||
|
@ -339,8 +340,8 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Repository> getRepositoriesOfUser(String page, String size) throws JSONException {
|
public List<Repository> getRepositoriesOfUser(String page, String size) throws JSONException {
|
||||||
String userEmail = ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail();
|
logger.debug("Retrieving repositories of authenticated user : {}",
|
||||||
logger.debug("Retrieving repositories of authenticated user : " + userEmail);
|
((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail());
|
||||||
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles());
|
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles());
|
||||||
return getRepositories(new ArrayList<>(repoIds));
|
return getRepositories(new ArrayList<>(repoIds));
|
||||||
}
|
}
|
||||||
|
@ -348,7 +349,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
@Override
|
@Override
|
||||||
public List<Repository> getRepositoriesOfUser(String userEmail, String page, String size) throws JSONException {
|
public List<Repository> getRepositoriesOfUser(String userEmail, String page, String size) throws JSONException {
|
||||||
logger.debug("Retrieving repositories of authenticated user : " + userEmail);
|
logger.debug("Retrieving repositories of authenticated user : " + userEmail);
|
||||||
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles(userEmail));
|
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRolesByEmail(userEmail));
|
||||||
return getRepositories(new ArrayList<>(repoIds));
|
return getRepositories(new ArrayList<>(repoIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +364,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
int to = from + Integer.parseInt(size);
|
int to = from + Integer.parseInt(size);
|
||||||
List<String> repoIds = new ArrayList<>();
|
List<String> repoIds = new ArrayList<>();
|
||||||
if (userEmail != null && !"".equals(userEmail)) {
|
if (userEmail != null && !"".equals(userEmail)) {
|
||||||
repoIds.addAll(roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles(userEmail)));
|
repoIds.addAll(roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRolesByEmail(userEmail)));
|
||||||
} else {
|
} else {
|
||||||
repoIds.addAll(roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles()));
|
repoIds.addAll(roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles()));
|
||||||
}
|
}
|
||||||
|
@ -644,7 +645,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
.fromHttpUrl(baseAddress + "/ds/api/")
|
.fromHttpUrl(baseAddress + "/ds/api/")
|
||||||
.path("/{id}")
|
.path("/{id}")
|
||||||
.build().expand(id).encode();
|
.build().expand(id).encode();
|
||||||
logger.debug(uriComponents.toUri());
|
logger.debug("{}", uriComponents.toUri());
|
||||||
restTemplate.delete(uriComponents.toUri());
|
restTemplate.delete(uriComponents.toUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.dnetlib.repo.manager.service;
|
package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
|
@ -19,7 +20,7 @@ import java.util.Objects;
|
||||||
@Service("statsService")
|
@Service("statsService")
|
||||||
public class StatsServiceImpl implements StatsService {
|
public class StatsServiceImpl implements StatsService {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(StatsServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(StatsServiceImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RestTemplate restTemplate;
|
RestTemplate restTemplate;
|
||||||
|
|
|
@ -3,6 +3,8 @@ package eu.dnetlib.repo.manager.service;
|
||||||
import eu.dnetlib.usagestats.sushilite.domain.Customer;
|
import eu.dnetlib.usagestats.sushilite.domain.Customer;
|
||||||
import eu.dnetlib.usagestats.sushilite.domain.ReportItem;
|
import eu.dnetlib.usagestats.sushilite.domain.ReportItem;
|
||||||
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
|
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
|
@ -25,7 +27,7 @@ public class SushiliteServiceImpl implements SushiliteService {
|
||||||
@Value("${services.provide.usagestats.sushiliteEndpoint}")
|
@Value("${services.provide.usagestats.sushiliteEndpoint}")
|
||||||
private String usagestatsSushiliteEndpoint;
|
private String usagestatsSushiliteEndpoint;
|
||||||
|
|
||||||
private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(SushiliteServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(SushiliteServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,8 @@ package eu.dnetlib.repo.manager.service;
|
||||||
|
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
import org.mitre.openid.connect.model.UserInfo;
|
import org.mitre.openid.connect.model.UserInfo;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
@ -16,8 +18,7 @@ import java.util.stream.Collectors;
|
||||||
@Service("userService")
|
@Service("userService")
|
||||||
public class UserServiceImpl implements UserService {
|
public class UserServiceImpl implements UserService {
|
||||||
|
|
||||||
private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger
|
private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
|
||||||
.getLogger(UserServiceImpl.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Object> login() {
|
public ResponseEntity<Object> login() {
|
||||||
|
|
|
@ -12,11 +12,12 @@ import eu.dnetlib.repo.manager.exception.ValidationServiceException;
|
||||||
import eu.dnetlib.repo.manager.utils.CrisValidatorUtils;
|
import eu.dnetlib.repo.manager.utils.CrisValidatorUtils;
|
||||||
import eu.dnetlib.repo.manager.utils.OaiTools;
|
import eu.dnetlib.repo.manager.utils.OaiTools;
|
||||||
import gr.uoa.di.driver.util.ServiceLocator;
|
import gr.uoa.di.driver.util.ServiceLocator;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.eurocris.openaire.cris.validator.model.Job;
|
import org.eurocris.openaire.cris.validator.model.Job;
|
||||||
import org.eurocris.openaire.cris.validator.service.JobExecutor;
|
import org.eurocris.openaire.cris.validator.service.JobExecutor;
|
||||||
import org.eurocris.openaire.cris.validator.service.MapJobDao;
|
import org.eurocris.openaire.cris.validator.service.MapJobDao;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
@ -58,7 +59,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
||||||
|
|
||||||
private Map<String, List<RuleSet>> rulesetMap = new ConcurrentHashMap<String, List<RuleSet>>();
|
private Map<String, List<RuleSet>> rulesetMap = new ConcurrentHashMap<String, List<RuleSet>>();
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ValidatorServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(ValidatorServiceImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmailUtils emailUtils;
|
private EmailUtils emailUtils;
|
||||||
|
@ -131,7 +132,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
} catch (ValidatorServiceException e) {
|
} catch (ValidatorServiceException e) {
|
||||||
logger.error(e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -161,7 +162,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
||||||
// this.getValidationService().submitValidationJob(jobForValidation);
|
// this.getValidationService().submitValidationJob(jobForValidation);
|
||||||
} catch (Exception e) { // FIXME: replaced exception with log
|
} catch (Exception e) { // FIXME: replaced exception with log
|
||||||
// throw new ValidatorServiceException(e);
|
// throw new ValidatorServiceException(e);
|
||||||
logger.error(e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return jobForValidation;
|
return jobForValidation;
|
||||||
|
|
|
@ -7,8 +7,9 @@ import eu.dnetlib.repo.manager.domain.dto.Role;
|
||||||
import eu.dnetlib.repo.manager.domain.dto.User;
|
import eu.dnetlib.repo.manager.domain.dto.User;
|
||||||
import eu.dnetlib.repo.manager.service.aai.registry.utils.RegistryUtils;
|
import eu.dnetlib.repo.manager.service.aai.registry.utils.RegistryUtils;
|
||||||
import eu.dnetlib.repo.manager.utils.HttpUtils;
|
import eu.dnetlib.repo.manager.utils.HttpUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
@ -23,7 +24,7 @@ import java.util.Map;
|
||||||
@Service
|
@Service
|
||||||
public class RegistryCalls implements AaiRegistryService {
|
public class RegistryCalls implements AaiRegistryService {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(RegistryCalls.class);
|
private static final Logger logger = LoggerFactory.getLogger(RegistryCalls.class);
|
||||||
|
|
||||||
private final String coid;
|
private final String coid;
|
||||||
public final HttpUtils httpUtils;
|
public final HttpUtils httpUtils;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.dnetlib.repo.manager.service.security;
|
package eu.dnetlib.repo.manager.service.security;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
@ -14,7 +15,7 @@ import java.util.stream.Collectors;
|
||||||
@Service("roleMappingService")
|
@Service("roleMappingService")
|
||||||
public class AaiRoleMappingService implements RoleMappingService {
|
public class AaiRoleMappingService implements RoleMappingService {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(AaiRoleMappingService.class);
|
private static final Logger logger = LoggerFactory.getLogger(AaiRoleMappingService.class);
|
||||||
|
|
||||||
@Value("${services.provide.aai.registry.production:true}")
|
@Value("${services.provide.aai.registry.production:true}")
|
||||||
private boolean production;
|
private boolean production;
|
||||||
|
|
|
@ -2,10 +2,11 @@ package eu.dnetlib.repo.manager.service.security;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.nimbusds.jose.util.StandardCharset;
|
import org.slf4j.Logger;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
import com.nimbusds.jose.util.StandardCharset;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
|
@ -15,7 +16,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class AuthoritiesMapper {
|
public class AuthoritiesMapper {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(AuthoritiesMapper.class);
|
private static final Logger logger = LoggerFactory.getLogger(AuthoritiesMapper.class);
|
||||||
private static final Pattern ENTITLEMENT_REGEX = Pattern.compile("urn:geant:openaire[.]eu:group:([^:]*):?(.*)?:role=member#aai[.]openaire[.]eu");
|
private static final Pattern ENTITLEMENT_REGEX = Pattern.compile("urn:geant:openaire[.]eu:group:([^:]*):?(.*)?:role=member#aai[.]openaire[.]eu");
|
||||||
|
|
||||||
private AuthoritiesMapper() {
|
private AuthoritiesMapper() {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package eu.dnetlib.repo.manager.service.security;
|
package eu.dnetlib.repo.manager.service.security;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
@ -21,7 +22,7 @@ import java.util.Map;
|
||||||
@Service
|
@Service
|
||||||
public class AuthoritiesUpdater extends HttpSessionSecurityContextRepository {
|
public class AuthoritiesUpdater extends HttpSessionSecurityContextRepository {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(AuthoritiesUpdater.class);
|
private static final Logger logger = LoggerFactory.getLogger(AuthoritiesUpdater.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
FindByIndexNameSessionRepository sessions;
|
FindByIndexNameSessionRepository sessions;
|
||||||
|
@ -30,7 +31,6 @@ public class AuthoritiesUpdater extends HttpSessionSecurityContextRepository {
|
||||||
if (sessions != null) {
|
if (sessions != null) {
|
||||||
Map map = sessions.findByIndexNameAndIndexValue(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, id);
|
Map map = sessions.findByIndexNameAndIndexValue(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, id);
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
logger.debug(map.values().toArray().length);
|
|
||||||
for ( Object sessionObject : map.values()) {
|
for ( Object sessionObject : map.values()) {
|
||||||
Session session = (Session) sessionObject;
|
Session session = (Session) sessionObject;
|
||||||
logger.debug(session.getId());
|
logger.debug(session.getId());
|
||||||
|
@ -39,7 +39,6 @@ public class AuthoritiesUpdater extends HttpSessionSecurityContextRepository {
|
||||||
Authentication authentication = securityContext.getAuthentication();
|
Authentication authentication = securityContext.getAuthentication();
|
||||||
if (authentication instanceof OIDCAuthenticationToken) {
|
if (authentication instanceof OIDCAuthenticationToken) {
|
||||||
OIDCAuthenticationToken authOIDC = (OIDCAuthenticationToken) authentication;
|
OIDCAuthenticationToken authOIDC = (OIDCAuthenticationToken) authentication;
|
||||||
logger.debug(update.authorities(authOIDC.getAuthorities()));
|
|
||||||
securityContext.setAuthentication(new OIDCAuthenticationToken(authOIDC.getSub(), authOIDC.getIssuer(),
|
securityContext.setAuthentication(new OIDCAuthenticationToken(authOIDC.getSub(), authOIDC.getIssuer(),
|
||||||
authOIDC.getUserInfo(), update.authorities(authOIDC.getAuthorities()), authOIDC.getIdToken(),
|
authOIDC.getUserInfo(), update.authorities(authOIDC.getAuthorities()), authOIDC.getIdToken(),
|
||||||
authOIDC.getAccessTokenValue(), authOIDC.getRefreshTokenValue()));
|
authOIDC.getAccessTokenValue(), authOIDC.getRefreshTokenValue()));
|
||||||
|
@ -65,7 +64,7 @@ public class AuthoritiesUpdater extends HttpSessionSecurityContextRepository {
|
||||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||||
if (auth instanceof OIDCAuthenticationToken) {
|
if (auth instanceof OIDCAuthenticationToken) {
|
||||||
OIDCAuthenticationToken oidcAuth = (OIDCAuthenticationToken) auth;
|
OIDCAuthenticationToken oidcAuth = (OIDCAuthenticationToken) auth;
|
||||||
this.addRole(oidcAuth.getUserInfo().getEmail(), role);
|
this.addRole(oidcAuth.getUserInfo().getSub(), role);
|
||||||
} else {
|
} else {
|
||||||
throw new UnauthorizedClientException("User auth is not instance of OIDCAuthenticationToken");
|
throw new UnauthorizedClientException("User auth is not instance of OIDCAuthenticationToken");
|
||||||
}
|
}
|
||||||
|
@ -83,7 +82,7 @@ public class AuthoritiesUpdater extends HttpSessionSecurityContextRepository {
|
||||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||||
if (auth instanceof OIDCAuthenticationToken) {
|
if (auth instanceof OIDCAuthenticationToken) {
|
||||||
OIDCAuthenticationToken oidcAuth = (OIDCAuthenticationToken) auth;
|
OIDCAuthenticationToken oidcAuth = (OIDCAuthenticationToken) auth;
|
||||||
this.removeRole(oidcAuth.getUserInfo().getEmail(), role);
|
this.removeRole(oidcAuth.getUserInfo().getSub(), role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,22 +38,22 @@ public interface AuthorizationService {
|
||||||
/**
|
/**
|
||||||
* Add a user as admin to a resource.
|
* Add a user as admin to a resource.
|
||||||
*
|
*
|
||||||
* @param id Resource id
|
* @param resourceId Resource id
|
||||||
* @param email User email
|
* @param email User email
|
||||||
* @return
|
* @return
|
||||||
* @throws ResourceNotFoundException
|
* @throws ResourceNotFoundException
|
||||||
*/
|
*/
|
||||||
boolean addAdmin(String id, String email) throws ResourceNotFoundException;
|
boolean addAdmin(String resourceId, String email) throws ResourceNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove user from resource admins.
|
* Remove user from resource admins.
|
||||||
*
|
*
|
||||||
* @param id Resource id
|
* @param resourceId Resource id
|
||||||
* @param email User email
|
* @param email User email
|
||||||
* @return
|
* @return
|
||||||
* @throws ResourceNotFoundException
|
* @throws ResourceNotFoundException
|
||||||
*/
|
*/
|
||||||
boolean removeAdmin(String id, String email) throws ResourceNotFoundException;
|
boolean removeAdmin(String resourceId, String email) throws ResourceNotFoundException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +69,6 @@ public interface AuthorizationService {
|
||||||
* @param email
|
* @param email
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Collection<String> getUserRoles(String email);
|
Collection<String> getUserRolesByEmail(String email);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ import com.google.gson.JsonElement;
|
||||||
import eu.dnetlib.repo.manager.domain.dto.User;
|
import eu.dnetlib.repo.manager.domain.dto.User;
|
||||||
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
||||||
import eu.dnetlib.repo.manager.service.aai.registry.AaiRegistryService;
|
import eu.dnetlib.repo.manager.service.aai.registry.AaiRegistryService;
|
||||||
import org.apache.log4j.LogManager;
|
import org.slf4j.Logger;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||||
import org.mitre.openid.connect.model.UserInfo;
|
import org.mitre.openid.connect.model.UserInfo;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -19,7 +19,7 @@ import java.util.List;
|
||||||
@Service("authorizationService")
|
@Service("authorizationService")
|
||||||
public class AuthorizationServiceImpl implements AuthorizationService {
|
public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
|
|
||||||
private static final Logger logger = LogManager.getLogger(AuthorizationServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(AuthorizationServiceImpl.class);
|
||||||
|
|
||||||
public static final String SUPER_ADMINISTRATOR = "SUPER_ADMINISTRATOR";
|
public static final String SUPER_ADMINISTRATOR = "SUPER_ADMINISTRATOR";
|
||||||
public static final String CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR = "CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR";
|
public static final String CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR = "CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR";
|
||||||
|
@ -70,7 +70,6 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<User> getAdminsOfRepo(String repoId) {
|
public List<User> getAdminsOfRepo(String repoId) {
|
||||||
List<String> userList = new ArrayList<>();
|
|
||||||
|
|
||||||
// find couId by role name
|
// find couId by role name
|
||||||
String role = roleMappingService.getRoleIdByRepoId(repoId);
|
String role = roleMappingService.getRoleIdByRepoId(repoId);
|
||||||
|
@ -80,17 +79,17 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addAdmin(String id, String email) throws ResourceNotFoundException {
|
public boolean addAdmin(String resourceId, String email) throws ResourceNotFoundException {
|
||||||
Integer coPersonId = aaiRegistryService.getCoPersonIdByEmail(email);
|
Integer coPersonId = aaiRegistryService.getCoPersonIdByEmail(email);
|
||||||
if (coPersonId != null) {
|
if (coPersonId != null) {
|
||||||
String role = roleMappingService.getRoleIdByRepoId(id);
|
String role = roleMappingService.getRoleIdByRepoId(resourceId);
|
||||||
Integer couId = aaiRegistryService.getCouId(role);
|
Integer couId = aaiRegistryService.getCouId(role);
|
||||||
if (couId != null) {
|
if (couId != null) {
|
||||||
Integer roleId = aaiRegistryService.getRoleId(coPersonId, couId);
|
Integer roleId = aaiRegistryService.getRoleId(coPersonId, couId);
|
||||||
aaiRegistryService.assignMemberRole(coPersonId, couId, roleId);
|
aaiRegistryService.assignMemberRole(coPersonId, couId, roleId);
|
||||||
|
|
||||||
// Add role to user current authorities
|
// Add role to user current authorities
|
||||||
authoritiesUpdater.addRole(email, roleMappingService.convertRepoIdToAuthority(id));
|
authoritiesUpdater.addRole(email, roleMappingService.convertRepoIdToAuthority(resourceId));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -102,10 +101,10 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeAdmin(String id, String email) throws ResourceNotFoundException {
|
public boolean removeAdmin(String resourceId, String email) throws ResourceNotFoundException {
|
||||||
Integer coPersonId = aaiRegistryService.getCoPersonIdByEmail(email);
|
Integer coPersonId = aaiRegistryService.getCoPersonIdByEmail(email);
|
||||||
if (coPersonId != null) {
|
if (coPersonId != null) {
|
||||||
String role = roleMappingService.getRoleIdByRepoId(id);
|
String role = roleMappingService.getRoleIdByRepoId(resourceId);
|
||||||
Integer couId = aaiRegistryService.getCouId(role);
|
Integer couId = aaiRegistryService.getCouId(role);
|
||||||
Integer roleId = null;
|
Integer roleId = null;
|
||||||
if (couId != null) {
|
if (couId != null) {
|
||||||
|
@ -115,7 +114,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
aaiRegistryService.removeMemberRole(coPersonId, couId, roleId);
|
aaiRegistryService.removeMemberRole(coPersonId, couId, roleId);
|
||||||
|
|
||||||
// Remove role from user current authorities
|
// Remove role from user current authorities
|
||||||
authoritiesUpdater.removeRole(email, roleMappingService.convertRepoIdToAuthority(id));
|
authoritiesUpdater.removeRole(email, roleMappingService.convertRepoIdToAuthority(resourceId));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -130,14 +129,16 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
public Collection<String> getUserRoles() {
|
public Collection<String> getUserRoles() {
|
||||||
Collection<String> roles;
|
Collection<String> roles;
|
||||||
UserInfo userInfo = ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo();
|
UserInfo userInfo = ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo();
|
||||||
roles = getUserRoles(userInfo.getEmail());
|
roles = getUserRolesByEmail(userInfo.getEmail());
|
||||||
|
|
||||||
logger.debug(String.format("User Roles: %s", String.join(",", roles)));
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("User Roles: {}", String.join(",", roles));
|
||||||
|
}
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getUserRoles(String email) {
|
public Collection<String> getUserRolesByEmail(String email) {
|
||||||
int coPersonId = aaiRegistryService.getCoPersonIdByEmail(email);
|
int coPersonId = aaiRegistryService.getCoPersonIdByEmail(email);
|
||||||
List<Integer> list = new ArrayList<>();
|
List<Integer> list = new ArrayList<>();
|
||||||
for (JsonElement element : aaiRegistryService.getRolesWithStatus(coPersonId, AaiRegistryService.RoleStatus.ACTIVE)) {
|
for (JsonElement element : aaiRegistryService.getRolesWithStatus(coPersonId, AaiRegistryService.RoleStatus.ACTIVE)) {
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
package eu.dnetlib.repo.manager.utils;
|
package eu.dnetlib.repo.manager.utils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import eu.dnetlib.repo.manager.domain.*;
|
import eu.dnetlib.repo.manager.domain.*;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
@ -20,12 +23,12 @@ import java.util.Objects;
|
||||||
@Component
|
@Component
|
||||||
public class Converter {
|
public class Converter {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(Converter.class);
|
private static final Logger logger = LoggerFactory.getLogger(Converter.class);
|
||||||
|
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
public Converter() {
|
public Converter() {
|
||||||
objectMapper = new ObjectMapper();
|
objectMapper = new ObjectMapper()/*.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)*/;
|
||||||
}
|
}
|
||||||
public Repository toRepository(Object repositoryObject) {
|
public Repository toRepository(Object repositoryObject) {
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@ package eu.dnetlib.repo.manager.utils;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -12,7 +13,7 @@ import java.util.Objects;
|
||||||
|
|
||||||
public class DateUtils {
|
public class DateUtils {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(DateUtils.class);
|
private static final Logger logger = LoggerFactory.getLogger(DateUtils.class);
|
||||||
|
|
||||||
public static Date toDate(String date) {
|
public static Date toDate(String date) {
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ public class DateUtils {
|
||||||
try {
|
try {
|
||||||
return formatter.parse(date);
|
return formatter.parse(date);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
logger.error(e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@ import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -16,7 +17,7 @@ import java.util.Map;
|
||||||
@Component
|
@Component
|
||||||
public class HttpUtils {
|
public class HttpUtils {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(HttpUtils.class);
|
private static final Logger logger = LoggerFactory.getLogger(HttpUtils.class);
|
||||||
|
|
||||||
@Value("${services.provide.aai.registry.url}")
|
@Value("${services.provide.aai.registry.url}")
|
||||||
private String registryUrl;
|
private String registryUrl;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package eu.dnetlib.repo.manager.utils;
|
package eu.dnetlib.repo.manager.utils;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.dom4j.io.DOMWriter;
|
import org.dom4j.io.DOMWriter;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import se.kb.oai.pmh.*;
|
import se.kb.oai.pmh.*;
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ public class OaiTools {
|
||||||
disableSslVerification();
|
disableSslVerification();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(OaiTools.class);
|
private static Logger logger = LoggerFactory.getLogger(OaiTools.class);
|
||||||
|
|
||||||
public static List<String> getSetsOfRepo(String baseUrl) throws Exception {
|
public static List<String> getSetsOfRepo(String baseUrl) throws Exception {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
</Console>
|
</Console>
|
||||||
</Appenders>
|
</Appenders>
|
||||||
<Loggers>
|
<Loggers>
|
||||||
|
<Root level="info">
|
||||||
|
<AppenderRef ref="LogToConsole"/>
|
||||||
|
</Root>
|
||||||
<Logger name="org.springframework.boot" level="error" additivity="false">
|
<Logger name="org.springframework.boot" level="error" additivity="false">
|
||||||
<AppenderRef ref="LogToConsole"/>
|
<AppenderRef ref="LogToConsole"/>
|
||||||
</Logger>
|
</Logger>
|
||||||
<Root level="error">
|
|
||||||
<AppenderRef ref="LogToConsole"/>
|
|
||||||
</Root>
|
|
||||||
</Loggers>
|
</Loggers>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
|
Loading…
Reference in New Issue