Merge log4j2 branch into master, before deleting log4j2 branch #1
145
pom.xml
145
pom.xml
|
@ -2,133 +2,81 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-orcid-service</artifactId>
|
||||
<version>1.0.1-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>uoa-orcid-service</name>
|
||||
|
||||
<!-- Use parent with artifact spring-boot-starter-parent and add plugin with artifact spring-boot-maven-plugin in order to run springboot run command-->
|
||||
<scm>
|
||||
<developerConnection>scm:git:gitea@code-repo.d4science.org:MaDgIK/uoa-orcid-service.git</developerConnection>
|
||||
</scm>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.11.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-spring-boot-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<!-- Comment parent with artifact dnet45-parent and <dependencyManagement> in order to run springboot run command -->
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>eu.dnetlib</groupId>-->
|
||||
<!-- <artifactId>dnet45-parent</artifactId>-->
|
||||
<!-- <version>1.0.0</version>-->
|
||||
<!-- </parent>-->
|
||||
<name>uoa-orcid-service</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<timestamp>${maven.build.timestamp}</timestamp>
|
||||
<maven.build.timestamp.format>E MMM dd HH:mm:ss z yyyy</maven.build.timestamp.format>
|
||||
</properties>
|
||||
|
||||
<!-- Comment parent with artifact dnet45-parent and <dependencyManagement> in order to run springboot run command -->
|
||||
<!-- <dependencyManagement>-->
|
||||
<!-- <dependencies>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-dependencies</artifactId>-->
|
||||
<!-- <version>1.5.11.RELEASE</version>-->
|
||||
<!-- <type>pom</type>-->
|
||||
<!-- <scope>import</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- </dependencies>-->
|
||||
<!-- </dependencyManagement>-->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId> org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.5.0-b01</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>20030203.000550</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>commons-io</groupId>-->
|
||||
<!-- <artifactId>commons-io</artifactId>-->
|
||||
<!-- <version>20030203.000550</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-authorization-library</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.httpcomponents</groupId>-->
|
||||
<!-- <artifactId>httpclient</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!--swagger-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger-version}</version>
|
||||
</dependency>
|
||||
<!--swagger official ui-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger-version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Use parent with artifact spring-boot-starter-parent and add plugin with artifact spring-boot-maven-plugin in order to run springboot run command-->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot-version}</version>
|
||||
<configuration>
|
||||
<mainClass>eu.dnetlib.uoaorcidservice.UoaOrcidServiceApplication</mainClass>
|
||||
<executable>true</executable>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!--3d answer: https://stackoverflow.com/questions/23260057/the-forked-vm-terminated-without-saying-properly-goodbye-vm-crash-or-system-exi-->
|
||||
<!--If you use openjdk there might be a problem with surfire plugin - uncomment following lines-->
|
||||
<!--<plugin>-->
|
||||
<!--<groupId>org.apache.maven.plugins</groupId>-->
|
||||
<!--<artifactId>maven-surefire-plugin</artifactId>-->
|
||||
<!--<version>2.19.1</version>-->
|
||||
<!--<configuration>-->
|
||||
<!--<!–<testFailureIgnore>true</testFailureIgnore>–>-->
|
||||
<!--<useSystemClassLoader>false</useSystemClassLoader>-->
|
||||
<!--</configuration>-->
|
||||
<!--</plugin>-->
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
|
@ -146,23 +94,4 @@
|
|||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dnet45-releases</id>
|
||||
<name>D-Net 45 Releases</name>
|
||||
<url>http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-releases</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<layout>default</layout>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
@ -2,6 +2,7 @@ package eu.dnetlib.uoaorcidservice;
|
|||
|
||||
import eu.dnetlib.uoaauthorizationlibrary.configuration.AuthorizationConfiguration;
|
||||
import eu.dnetlib.uoaorcidservice.configuration.GlobalVars;
|
||||
import eu.dnetlib.uoaorcidservice.configuration.properties.APIProperties;
|
||||
import eu.dnetlib.uoaorcidservice.configuration.properties.MongoConfig;
|
||||
//import eu.dnetlib.uoaauthorizationlibrary.configuration.AuthorizationConfiguration;
|
||||
import eu.dnetlib.uoaorcidservice.configuration.properties.OrcidConfig;
|
||||
|
@ -19,7 +20,7 @@ import org.springframework.context.annotation.PropertySources;
|
|||
@PropertySource("classpath:orcidservice.properties"),
|
||||
@PropertySource(value = "classpath:dnet-override.properties", ignoreResourceNotFound = true)
|
||||
})
|
||||
@EnableConfigurationProperties({MongoConfig.class, AESUtils.class, OrcidConfig.class, GlobalVars.class})
|
||||
@EnableConfigurationProperties({MongoConfig.class, AESUtils.class, OrcidConfig.class, GlobalVars.class, APIProperties.class})
|
||||
@Import(AuthorizationConfiguration.class)
|
||||
public class UoaOrcidServiceApplication {
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.dnetlib.uoaorcidservice;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
|
@ -9,7 +10,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|||
|
||||
@Configuration
|
||||
public class UoaOrcidServiceConfiguration extends WebMvcConfigurerAdapter {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
|
||||
@Bean
|
||||
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
package eu.dnetlib.uoaorcidservice.configuration;
|
||||
|
||||
import eu.dnetlib.uoaorcidservice.configuration.properties.APIProperties;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Swagger configuration class
|
||||
*/
|
||||
@Configuration
|
||||
@Profile({"swagger"})
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig extends WebMvcConfigurerAdapter {
|
||||
|
||||
private final APIProperties apiProperties;
|
||||
|
||||
@Autowired
|
||||
public SwaggerConfig(APIProperties apiProperties) {
|
||||
this.apiProperties = apiProperties;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
// .globalOperationParameters(globalParameterList())
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("eu.dnetlib.uoaorcidservice.controllers"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket createRestApiAuthorizationLibrary() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.groupName("Authorization Library")
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("eu.dnetlib.uoaauthorizationlibrary.controllers"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title(this.apiProperties.getTitle())
|
||||
.description(this.apiProperties.getDescription())
|
||||
.version(this.apiProperties.getVersion())
|
||||
.build();
|
||||
}
|
||||
|
||||
private List<Parameter> globalParameterList() {
|
||||
Parameter authTokenHeader = new ParameterBuilder()
|
||||
.name("Session") // name of the header
|
||||
.modelRef(new ModelRef("string")) // data-type of the header
|
||||
.required(false)
|
||||
.parameterType("header")
|
||||
.description("Session ID")
|
||||
.build();
|
||||
return Collections.singletonList(authTokenHeader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
registry.addRedirectViewController("/v2/api-docs", "/v2/api-docs");
|
||||
registry.addRedirectViewController("/swagger-resources/configuration/ui", "/swagger-resources/configuration/ui");
|
||||
registry.addRedirectViewController("/swagger-resources/configuration/security", "/swagger-resources/configuration/security");
|
||||
registry.addRedirectViewController("/swagger-resources", "/swagger-resources");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/swagger-ui.html**").addResourceLocations("classpath:/META-INF/resources/swagger-ui.html");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package eu.dnetlib.uoaorcidservice.configuration.properties;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties("api")
|
||||
public class APIProperties {
|
||||
|
||||
private String title;
|
||||
private String description;
|
||||
private String version;
|
||||
|
||||
public APIProperties() {
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package eu.dnetlib.uoaorcidservice.controllers;
|
||||
|
||||
import eu.dnetlib.uoaorcidservice.configuration.properties.OrcidConfig;
|
||||
import eu.dnetlib.uoaorcidservice.services.MetricsService;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
|
@ -15,8 +15,8 @@ import java.util.List;
|
|||
@RestController
|
||||
@CrossOrigin(origins = "*")
|
||||
public class MetricsController {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger orcid_log = Logger.getLogger("ORCID-" + this.getClass().getName());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
private final Logger orcid_log = LogManager.getLogger("ORCID-" + this.getClass().getName());
|
||||
|
||||
@Autowired
|
||||
private MetricsService metricsService;
|
||||
|
|
|
@ -3,15 +3,13 @@ package eu.dnetlib.uoaorcidservice.controllers;
|
|||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.CommandResult;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.MongoTimeoutException;
|
||||
import eu.dnetlib.uoaorcidservice.configuration.GlobalVars;
|
||||
import eu.dnetlib.uoaorcidservice.configuration.mongo.MongoConnection;
|
||||
import eu.dnetlib.uoaorcidservice.configuration.properties.MongoConfig;
|
||||
import eu.dnetlib.uoaorcidservice.configuration.properties.OrcidConfig;
|
||||
import eu.dnetlib.uoaorcidservice.handlers.utils.AESUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bson.*;
|
||||
import org.bson.conversions.Bson;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
@ -20,14 +18,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(origins = "*")
|
||||
public class OrcidServiceCheckDeployController {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private MongoConnection mongoConnection;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package eu.dnetlib.uoaorcidservice.controllers;
|
||||
import eu.dnetlib.uoaorcidservice.responses.ExceptionResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
|
||||
import org.springframework.boot.autoconfigure.web.ErrorController;
|
||||
//import org.springframework.boot.web.servlet.error.ErrorAttributes;
|
||||
//import org.springframework.boot.web.servlet.error.ErrorController;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.Assert;
|
||||
|
@ -14,9 +13,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.context.request.ServletWebRequest;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -26,8 +22,8 @@ import java.util.Map;
|
|||
@CrossOrigin(origins = "*")
|
||||
@RequestMapping("/error")
|
||||
public class SimpleErrorController implements ErrorController {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger orcid_log = Logger.getLogger("ORCID-"+this.getClass().getName());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
private final Logger orcid_log = LogManager.getLogger("ORCID-"+this.getClass().getName());
|
||||
|
||||
private final ErrorAttributes errorAttributes;
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ package eu.dnetlib.uoaorcidservice.controllers;
|
|||
|
||||
import eu.dnetlib.uoaorcidservice.configuration.properties.OrcidConfig;
|
||||
import eu.dnetlib.uoaorcidservice.entities.UserTokens;
|
||||
import eu.dnetlib.uoaorcidservice.handlers.utils.AESUtils;
|
||||
import eu.dnetlib.uoaorcidservice.responses.SingleValueWrapperResponse;
|
||||
import eu.dnetlib.uoaorcidservice.services.UserTokensService;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.security.access.AuthorizationServiceException;
|
||||
|
@ -22,16 +22,14 @@ import java.security.InvalidAlgorithmParameterException;
|
|||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
//@RequestMapping("/orcid")
|
||||
@PreAuthorize("isAuthenticated()")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class UserTokensController {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger orcid_log = Logger.getLogger("ORCID-"+this.getClass().getName());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
private final Logger orcid_log = LogManager.getLogger("ORCID-"+this.getClass().getName());
|
||||
|
||||
@Autowired
|
||||
private OrcidConfig orcidConfig;
|
||||
|
|
|
@ -10,7 +10,8 @@ import eu.dnetlib.uoaorcidservice.handlers.ConflictException;
|
|||
import eu.dnetlib.uoaorcidservice.handlers.ContentNotFoundException;
|
||||
import eu.dnetlib.uoaorcidservice.services.UserTokensService;
|
||||
import eu.dnetlib.uoaorcidservice.services.WorkService;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.security.access.AuthorizationServiceException;
|
||||
|
@ -34,8 +35,8 @@ import java.util.*;
|
|||
@PreAuthorize("isAuthenticated()")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class WorkController {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger orcid_log = Logger.getLogger("ORCID-"+this.getClass().getName());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
private final Logger orcid_log = LogManager.getLogger("ORCID-"+this.getClass().getName());
|
||||
|
||||
@Autowired
|
||||
private OrcidConfig orcidConfig;
|
||||
|
|
|
@ -2,7 +2,8 @@ package eu.dnetlib.uoaorcidservice.dao.customDAOsImpl;
|
|||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import eu.dnetlib.uoaorcidservice.dao.customDAOs.MongoDBUserTokensDAOCustom;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
|
@ -16,7 +17,7 @@ import static org.springframework.data.mongodb.core.aggregation.Aggregation.*;
|
|||
import static org.springframework.data.mongodb.core.aggregation.Aggregation.newAggregationOptions;
|
||||
|
||||
public class MongoDBUserTokensDAOImpl implements MongoDBUserTokensDAOCustom {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
|
||||
private final MongoTemplate mongoTemplate;
|
||||
|
||||
|
|
|
@ -2,10 +2,9 @@ package eu.dnetlib.uoaorcidservice.dao.customDAOsImpl;
|
|||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import eu.dnetlib.uoaorcidservice.dao.customDAOs.MongoDBWorkDAOCustom;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.aggregation.*;
|
||||
|
@ -15,7 +14,7 @@ import java.util.List;
|
|||
import static org.springframework.data.mongodb.core.aggregation.Aggregation.*;
|
||||
|
||||
public class MongoDBWorkDAOImpl implements MongoDBWorkDAOCustom {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
|
||||
private final MongoTemplate mongoTemplate;
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package eu.dnetlib.uoaorcidservice.handlers;
|
||||
|
||||
//import eu.dnetlib.uoaadmintoolslibrary.responses.ExceptionResponse;
|
||||
|
||||
//import eu.dnetlib.uoaadmintoolslibrary.handlers.InvalidReCaptchaException;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import eu.dnetlib.uoaorcidservice.responses.ExceptionResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.AuthorizationServiceException;
|
||||
|
@ -16,7 +14,7 @@ import java.nio.file.AccessDeniedException;
|
|||
|
||||
@ControllerAdvice
|
||||
public class ExceptionsHandler {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
|
||||
// @ExceptionHandler(MissingServletRequestParameterException.class)
|
||||
// public ResponseEntity<ExceptionResponse> invalidInput(Exception ex) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.dnetlib.uoaorcidservice.handlers.utils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
|
@ -10,11 +11,9 @@ import javax.crypto.SecretKey;
|
|||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.SealedObject;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.io.*;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
|
@ -27,7 +26,7 @@ import java.util.Base64;
|
|||
|
||||
@ConfigurationProperties("orcidservice.encryption")
|
||||
public class AESUtils {
|
||||
private static final Logger log = Logger.getLogger(AESUtils.class);
|
||||
private static final Logger log = LogManager.getLogger(AESUtils.class);
|
||||
|
||||
private static String password;
|
||||
public String getPassword() {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package eu.dnetlib.uoaorcidservice.handlers.utils;
|
||||
|
||||
import eu.dnetlib.uoaauthorizationlibrary.security.AuthorizationService;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -12,7 +13,7 @@ public class RolesUtils {
|
|||
@Autowired
|
||||
private AuthorizationService authorizationService;
|
||||
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
|
||||
public List<String> getRoles() {
|
||||
return authorizationService.getRoles();
|
||||
|
|
|
@ -4,7 +4,8 @@ import eu.dnetlib.uoaorcidservice.dao.MetricsDAO;
|
|||
import eu.dnetlib.uoaorcidservice.dao.customDAOs.MongoDBUserTokensDAOCustom;
|
||||
import eu.dnetlib.uoaorcidservice.dao.customDAOs.MongoDBWorkDAOCustom;
|
||||
import eu.dnetlib.uoaorcidservice.entities.Metrics;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
@ -18,7 +19,7 @@ import java.util.*;
|
|||
@EnableScheduling
|
||||
@Service
|
||||
public class MetricsService {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
@Qualifier("mongoDBWorkDAO")
|
||||
|
|
|
@ -5,15 +5,14 @@ import eu.dnetlib.uoaorcidservice.dao.UserTokensDAO;
|
|||
import eu.dnetlib.uoaorcidservice.entities.UserTokens;
|
||||
import eu.dnetlib.uoaorcidservice.handlers.utils.AESUtils;
|
||||
import eu.dnetlib.uoaorcidservice.handlers.utils.RolesUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
|
@ -26,7 +25,7 @@ import java.util.List;
|
|||
|
||||
@Service
|
||||
public class UserTokensService {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private UserTokensDAO userTokensDAO;
|
||||
|
|
|
@ -2,7 +2,8 @@ package eu.dnetlib.uoaorcidservice.services;
|
|||
|
||||
import eu.dnetlib.uoaorcidservice.dao.WorkDAO;
|
||||
import eu.dnetlib.uoaorcidservice.entities.Work;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -10,7 +11,7 @@ import java.util.List;
|
|||
|
||||
@Service
|
||||
public class WorkService {
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private WorkDAO workDAO;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#static properties
|
||||
api.title = Uoa Orcid Service Documentation Swagger
|
||||
api.description = Uoa Orcid Service is a service which communicates with ORCID API, sends and saves locally ORCiD claims from users
|
||||
api.version = ${project.version}
|
|
@ -1,29 +0,0 @@
|
|||
log4j.rootLogger = DEBUG, R
|
||||
|
||||
log4j.logger.eu.dnetlib = DEBUG
|
||||
log4j.logger.ORCID-eu.dnetlib = DEBUG, ORCID
|
||||
log4j.logger.org.springframework = DEBUG, S
|
||||
|
||||
log4j.additivity.org.springframework = false
|
||||
|
||||
log4j.appender.R=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.R.File=/var/log/dnet/uoa-orcid-service/uoa-orcid-service.log
|
||||
log4j.appender.R.MaxFileSize=10MB
|
||||
log4j.appender.R.MaxBackupIndex=10
|
||||
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
||||
|
||||
log4j.appender.S=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.S.File=/var/log/dnet/uoa-orcid-service/uoa-orcid-service-spring.log
|
||||
log4j.appender.S.MaxFileSize=10MB
|
||||
log4j.appender.S.MaxBackupIndex=10
|
||||
log4j.appender.S.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.S.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
||||
|
||||
#log4j.ORCID.name = ORCID
|
||||
log4j.appender.ORCID=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.ORCID.File=/var/log/dnet/uoa-orcid-service/uoa-orcid-service-orcid.log
|
||||
log4j.appender.ORCID.MaxFileSize=10MB
|
||||
log4j.appender.ORCID.MaxBackupIndex=10
|
||||
log4j.appender.ORCID.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.ORCID.layout.ConversionPattern= %d %p %t [%c] - %m%n
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN" monitorInterval="30">
|
||||
<Properties>
|
||||
<Property name="LOG_PATTERN">
|
||||
%d %p %t [%c] - %m%n
|
||||
</Property>
|
||||
</Properties>
|
||||
<Appenders>
|
||||
<!-- Rolling File Appender -->
|
||||
<RollingFile name="ORCID" fileName="/var/log/dnet/uoa-orcid-service/uoa-orcid-service-orcid.log"
|
||||
filePattern="/var/log/dnet/uoa-orcid-service/uoa-orcid-service-orcid-%d{yyyy-MM-dd}-%i.log">
|
||||
<PatternLayout>
|
||||
<Pattern>${LOG_PATTERN}</Pattern>
|
||||
</PatternLayout>
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="10MB" />
|
||||
</Policies>
|
||||
<DefaultRolloverStrategy max="10"/>
|
||||
</RollingFile>
|
||||
<RollingFile name="R" fileName="/var/log/dnet/uoa-orcid-service/uoa-orcid-service.log"
|
||||
filePattern="/var/log/dnet/uoa-orcid-service/uoa-orcid-service-%d{yyyy-MM-dd}-%i.log">
|
||||
<PatternLayout>
|
||||
<Pattern>${LOG_PATTERN}</Pattern>
|
||||
</PatternLayout>
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="10MB" />
|
||||
</Policies>
|
||||
<DefaultRolloverStrategy max="10"/>
|
||||
</RollingFile>
|
||||
<RollingFile name="S" fileName="/var/log/dnet/uoa-orcid-service/uoa-orcid-service-spring.log"
|
||||
filePattern="/var/log/dnet/uoa-orcid-service/uoa-orcid-service-spring-%d{yyyy-MM-dd}-%i.log">
|
||||
<PatternLayout>
|
||||
<Pattern>${LOG_PATTERN}</Pattern>
|
||||
</PatternLayout>
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="10MB" />
|
||||
</Policies>
|
||||
<DefaultRolloverStrategy max="10"/>
|
||||
</RollingFile>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="ORCID-eu.dnetlib" level="debug" additivity="false">
|
||||
<AppenderRef ref="ORCID"/>
|
||||
</Logger>
|
||||
<Logger name="eu.dnetlib" level="debug" additivity="false">
|
||||
<AppenderRef ref="R"/>
|
||||
</Logger>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="S"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
Loading…
Reference in New Issue