merged properties branch
This commit is contained in:
parent
b5f1c113c6
commit
9d38d86c03
2
pom.xml
2
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
<groupId>eu.dnetlib</groupId>
|
<groupId>eu.dnetlib</groupId>
|
||||||
<artifactId>uoa-repository-manager-service</artifactId>
|
<artifactId>uoa-repository-manager-service</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring.boot.version>2.5.4</spring.boot.version>
|
<spring.boot.version>2.5.4</spring.boot.version>
|
||||||
|
|
|
@ -24,22 +24,22 @@ import java.util.*;
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
public class AaiSecurityConfiguration extends WebSecurityConfigurerAdapter {
|
public class AaiSecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
@Value("${webapp.dev.front}")
|
@Value("${services.provide.aai.oidc.webURL}")
|
||||||
private String logoutSuccessUrl;
|
private String logoutSuccessUrl;
|
||||||
|
|
||||||
@Value("${oidc.issuer}")
|
@Value("${services.provide.aai.oidc.issuer}")
|
||||||
private String oidcIssuer;
|
private String oidcIssuer;
|
||||||
|
|
||||||
@Value("${oidc.id}")
|
@Value("${services.provide.aai.oidc.id}")
|
||||||
private String oidcId;
|
private String oidcId;
|
||||||
|
|
||||||
@Value("${oidc.secret}")
|
@Value("${services.provide.aai.oidc.secret}")
|
||||||
private String oidcSecret;
|
private String oidcSecret;
|
||||||
|
|
||||||
@Value("${oidc.dev.home}")
|
@Value("${services.provide.aai.oidc.redirectURL}")
|
||||||
private String oidcDevHome;
|
private String oidcDevHome;
|
||||||
|
|
||||||
@Value("${webapp.dev.front}")
|
@Value("${services.provide.aai.oidc.webURL}")
|
||||||
private String webAppFrontEnd;
|
private String webAppFrontEnd;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
package eu.dnetlib.repo.manager.config;
|
|
||||||
|
|
||||||
import org.springframework.beans.BeansException;
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
|
||||||
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CascadingPropertyLoader loads a number of property files and mergers them together, so that the last properties
|
|
||||||
* override the previous. It also supports property expansion like:
|
|
||||||
*
|
|
||||||
* <code>
|
|
||||||
* something = 1
|
|
||||||
* somethingelse = 2
|
|
||||||
* test = ${something}/${somethingelse}
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* And if you override something to XX, then test will become XX/2
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author marko
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class CascadingPropertyLoader extends PropertyPlaceholderConfigurer implements InitializingBean {
|
|
||||||
|
|
||||||
private Properties properties;
|
|
||||||
|
|
||||||
public void afterPropertiesSet() throws Exception {
|
|
||||||
this.properties = mergeProperties();
|
|
||||||
|
|
||||||
// Convert the merged properties, if necessary.
|
|
||||||
convertProperties(this.properties);
|
|
||||||
|
|
||||||
logger.debug("Properties: " + properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void processProperties(final ConfigurableListableBeanFactory beanFactoryToProcess, final Properties props) throws BeansException {
|
|
||||||
super.processProperties(beanFactoryToProcess, props);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Properties getProperties() {
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProperties(final Properties properties) {
|
|
||||||
super.setProperties(properties);
|
|
||||||
|
|
||||||
this.properties = properties;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,10 +20,10 @@ import org.springframework.context.annotation.*;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
@Value("${ISLookUpService.url}")
|
@Value("${services.provide.iSLookUpService.url}")
|
||||||
private String lookupURL;
|
private String lookupURL;
|
||||||
|
|
||||||
@Value("${ValidatorService.url}")
|
@Value("${services.provide.validatorService.url}")
|
||||||
private String validatorUrl;
|
private String validatorUrl;
|
||||||
|
|
||||||
@Bean(name="vocabularyLoader")
|
@Bean(name="vocabularyLoader")
|
||||||
|
|
|
@ -14,16 +14,16 @@ public class DatasourceConfiguration {
|
||||||
|
|
||||||
private static Logger LOGGER = Logger.getLogger(DatasourceConfiguration.class);
|
private static Logger LOGGER = Logger.getLogger(DatasourceConfiguration.class);
|
||||||
|
|
||||||
@Value("${services.repomanager.db.driverClassName}")
|
@Value("${services.provide.db.driverClassName}")
|
||||||
private String driverClassname;
|
private String driverClassname;
|
||||||
|
|
||||||
@Value("${services.repomanager.db.url}")
|
@Value("${services.provide.db.url}")
|
||||||
private String URL;
|
private String URL;
|
||||||
|
|
||||||
@Value("${services.repomanager.db.username}")
|
@Value("${services.provide.db.username}")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Value("${services.repomanager.db.password}")
|
@Value("${services.provide.db.password}")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Value("${aai.mode}")
|
@Value("${services.provide.aai.oidc.domain}")
|
||||||
private String aai_mode;
|
private String domain;
|
||||||
|
|
||||||
@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 {
|
||||||
|
@ -47,8 +47,7 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati
|
||||||
} else {
|
} else {
|
||||||
accessToken.setMaxAge(3600);
|
accessToken.setMaxAge(3600);
|
||||||
}
|
}
|
||||||
if (aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta"))
|
accessToken.setDomain(domain);
|
||||||
accessToken.setDomain(".openaire.eu");
|
|
||||||
accessToken.setPath("/");
|
accessToken.setPath("/");
|
||||||
|
|
||||||
response.addCookie(accessToken);
|
response.addCookie(accessToken);
|
||||||
|
|
|
@ -8,31 +8,31 @@ import org.springframework.context.annotation.Configuration;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class MailConfig {
|
public class MailConfig {
|
||||||
|
|
||||||
@Value("${services.repomanager.mail.host}")
|
@Value("${services.provide.mail.host}")
|
||||||
private String host;
|
private String host;
|
||||||
|
|
||||||
@Value("${services.repomanager.mail.port}")
|
@Value("${services.provide.mail.port}")
|
||||||
private int port;
|
private int port;
|
||||||
|
|
||||||
@Value("${services.repomanager.mail.authenticate}")
|
@Value("${services.provide.mail.authenticate}")
|
||||||
private boolean authenticate;
|
private boolean authenticate;
|
||||||
|
|
||||||
@Value("${services.repomanager.mail.username}")
|
@Value("${services.provide.mail.username}")
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
@Value("${services.repomanager.mail.password}")
|
@Value("${services.provide.mail.password}")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Value("${services.repomanager.mail.from}")
|
@Value("${services.provide.mail.from}")
|
||||||
private String from;
|
private String from;
|
||||||
|
|
||||||
@Value("${services.repomanager.mail.replyTo}")
|
@Value("${services.provide.mail.replyTo}")
|
||||||
private String replyTo;
|
private String replyTo;
|
||||||
|
|
||||||
@Value("${services.repomanager.mail.mode}")
|
@Value("${services.provide.mail.mode}")
|
||||||
private String mode;
|
private String mode;
|
||||||
|
|
||||||
@Value("${services.repomanager.mail.debug}")
|
@Value("${services.provide.mail.debug}")
|
||||||
private boolean debug;
|
private boolean debug;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class OpenAIREAuthoritiesMapper implements OIDCAuthoritiesMapper {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(OpenAIREAuthoritiesMapper.class);
|
private static final Logger logger = Logger.getLogger(OpenAIREAuthoritiesMapper.class);
|
||||||
|
|
||||||
@Value("${services.repo-manager.adminEmail}")
|
@Value("${services.provide.adminEmail}")
|
||||||
String adminEmail;
|
String adminEmail;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,7 +15,6 @@ import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableRedisHttpSession
|
@EnableRedisHttpSession
|
||||||
@PropertySource(value = {"classpath:application.properties"} )
|
|
||||||
@ComponentScan(basePackages = {
|
@ComponentScan(basePackages = {
|
||||||
"org.eurocris.openaire.cris.validator.service",
|
"org.eurocris.openaire.cris.validator.service",
|
||||||
"eu.dnetlib.repo.manager.*"})
|
"eu.dnetlib.repo.manager.*"})
|
||||||
|
@ -23,17 +22,17 @@ public class RedisConfiguration {
|
||||||
|
|
||||||
private static Logger LOGGER = Logger.getLogger(RedisConfiguration.class);
|
private static Logger LOGGER = Logger.getLogger(RedisConfiguration.class);
|
||||||
|
|
||||||
@Value("${redis.host}")
|
@Value("${services.provide.redis.host}")
|
||||||
private String host;
|
private String host;
|
||||||
|
|
||||||
@Value("${redis.port:6379}")
|
@Value("${services.provide.redis.port:6379}")
|
||||||
private String port;
|
private String port;
|
||||||
|
|
||||||
@Value("${redis.password}")
|
@Value("${services.provide.redis.password}")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Value("${aai.mode}")
|
@Value("${services.provide.aai.oidc.domain}")
|
||||||
private String aai_mode;
|
private String domain;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void init(){
|
private void init(){
|
||||||
|
@ -56,9 +55,7 @@ public class RedisConfiguration {
|
||||||
DefaultCookieSerializer serializer = new DefaultCookieSerializer();
|
DefaultCookieSerializer serializer = new DefaultCookieSerializer();
|
||||||
serializer.setCookieName("openAIRESession");
|
serializer.setCookieName("openAIRESession");
|
||||||
serializer.setCookiePath("/");
|
serializer.setCookiePath("/");
|
||||||
if(aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta"))
|
serializer.setDomainName(domain);
|
||||||
serializer.setDomainName(".openaire.eu");
|
|
||||||
// serializer.setDomainName(".athenarc.gr");
|
|
||||||
LOGGER.info("Serializer : " + serializer);
|
LOGGER.info("Serializer : " + serializer);
|
||||||
return serializer;
|
return serializer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,109 +0,0 @@
|
||||||
package eu.dnetlib.repo.manager.config;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.springframework.beans.BeansException;
|
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|
||||||
import org.springframework.web.context.ContextLoaderListener;
|
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
import org.springframework.web.context.support.XmlWebApplicationContext;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class RepoManagerContextLoaderListener extends ContextLoaderListener {
|
|
||||||
private static Logger logger = Logger.getLogger(RepoManagerContextLoaderListener.class);
|
|
||||||
|
|
||||||
|
|
||||||
public RepoManagerContextLoaderListener() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public RepoManagerContextLoaderListener(WebApplicationContext context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected WebApplicationContext createWebApplicationContext(
|
|
||||||
ServletContext servletContext)
|
|
||||||
throws BeansException {
|
|
||||||
logger.debug("Creating web application context");
|
|
||||||
Properties props = this.loadProperties();
|
|
||||||
String repoMode = props.getProperty("services.validator.mode.repo");
|
|
||||||
String userMode = props.getProperty("services.validator.mode.user");
|
|
||||||
Boolean standaloneMode = Boolean.parseBoolean(props.getProperty("services.validator.mode.standalone"));
|
|
||||||
|
|
||||||
logger.info("User mode: " + userMode);
|
|
||||||
logger.info("Repo mode: " + repoMode);
|
|
||||||
logger.info("Standalone mode: " + standaloneMode);
|
|
||||||
// logger.info("Dnet workflow enabled: " + repoMode);
|
|
||||||
XmlWebApplicationContext ctx = new XmlWebApplicationContext();
|
|
||||||
|
|
||||||
ctx.setServletContext(servletContext);
|
|
||||||
|
|
||||||
String userApiContext = null;
|
|
||||||
if (userMode.equalsIgnoreCase("local"))
|
|
||||||
userApiContext = "eu/dnetlib/validator/web/api/impls/users/springContext-validator-user-local.xml";
|
|
||||||
else if (userMode.equalsIgnoreCase("ldap"))
|
|
||||||
userApiContext = "eu/dnetlib/users/springContext-users-ldap.xml";
|
|
||||||
|
|
||||||
String[] springContextCore = new String[] {
|
|
||||||
"classpath:META-INF/cxf/cxf.xml",
|
|
||||||
"classpath:META-INF/cxf/cxf-extension-soap.xml",
|
|
||||||
"classpath:META-INF/cxf/cxf-extension-jaxws.xml",
|
|
||||||
"classpath:META-INF/cxf/cxf-servlet.xml",
|
|
||||||
"classpath*:/cxf.xml",
|
|
||||||
"classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml",
|
|
||||||
"classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml",
|
|
||||||
"classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml",
|
|
||||||
// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-struts.xml",
|
|
||||||
// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-emailer.xml",
|
|
||||||
// "classpath*:/eu/dnetlib/validator/web/config/springContext-validator.xml",
|
|
||||||
"classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml",
|
|
||||||
// "classpath*:/eu/dnetlib/validator/commons/dao/springContext-*.xml",
|
|
||||||
"classpath*:/eu/dnetlib/repos/springContext-repos-" + repoMode + ".xml",
|
|
||||||
"classpath*:/" + userApiContext
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
String[] springContextForStandalone = new String[] {
|
|
||||||
};
|
|
||||||
|
|
||||||
String[] springContextForIS = new String[] {
|
|
||||||
"classpath*:/gr/uoa/di/driver/util/springContext-locators.xml",
|
|
||||||
"classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml",
|
|
||||||
"classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml",
|
|
||||||
"classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml",
|
|
||||||
"classpath*:/gr/uoa/di/driver/app/springContext-commons.xml",
|
|
||||||
"classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"
|
|
||||||
};
|
|
||||||
|
|
||||||
if (standaloneMode) {
|
|
||||||
logger.debug("Loading contexts for standalone mode");
|
|
||||||
ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForStandalone));
|
|
||||||
} else {
|
|
||||||
logger.debug("Loading contexts for dnet");
|
|
||||||
ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForIS));
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.refresh();
|
|
||||||
|
|
||||||
logger.debug("done");
|
|
||||||
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Properties loadProperties() {
|
|
||||||
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {
|
|
||||||
"classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml"
|
|
||||||
});
|
|
||||||
|
|
||||||
CascadingPropertyLoader pLoader = (CascadingPropertyLoader) ctx.getBean("propertyLoader");
|
|
||||||
Properties props = pLoader.getProperties();
|
|
||||||
|
|
||||||
ctx.destroy();
|
|
||||||
ctx.close();
|
|
||||||
return props;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -18,9 +18,9 @@ import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
@RestController
|
//@RestController
|
||||||
@RequestMapping(value = "/role-management")
|
//@RequestMapping(value = "/role-management")
|
||||||
@Api(description = "Role Management", value = "role-management")
|
//@Api(description = "Role Management", value = "role-management")
|
||||||
public class UserRoleController {
|
public class UserRoleController {
|
||||||
|
|
||||||
private final AaiRegistryService aaiRegistryService;
|
private final AaiRegistryService aaiRegistryService;
|
||||||
|
|
|
@ -33,11 +33,11 @@ public class BrokerServiceImpl implements BrokerService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RepositoryServiceImpl repoAPI;
|
private RepositoryServiceImpl repoAPI;
|
||||||
@Value("${services.broker.url}:${services.broker.port}/${services.broker.api}${services.broker.openaire}")
|
@Value("${services.provide.broker.url}:${services.provide.broker.port}/${services.provide.broker.api}${services.provide.broker.openaire}")
|
||||||
private String openairePath;
|
private String openairePath;
|
||||||
@Value("${services.broker.url}:${services.broker.port}/${services.broker.api}")
|
@Value("${services.provide.broker.url}:${services.provide.broker.port}/${services.provide.broker.api}")
|
||||||
private String apiPath;
|
private String apiPath;
|
||||||
@Value("${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
|
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger
|
||||||
|
|
|
@ -26,16 +26,16 @@ public class EmailUtilsImpl implements EmailUtils {
|
||||||
private final MailLibrary mailLibrary;
|
private final MailLibrary mailLibrary;
|
||||||
private final RepositoryService repositoryService;
|
private final RepositoryService repositoryService;
|
||||||
|
|
||||||
@Value("${services.repomanager.baseUrl}")
|
@Value("${services.provide.baseUrl}")
|
||||||
private String baseUrl;
|
private String baseUrl;
|
||||||
|
|
||||||
@Value("${services.repomanager.usagestats.adminEmail}")
|
@Value("${services.provide.usagestats.adminEmail}")
|
||||||
private String usageStatsAdminEmail;
|
private String usageStatsAdminEmail;
|
||||||
|
|
||||||
@Value("${services.repomanager.provide.adminEmail}")
|
@Value("${services.provide.adminEmail}")
|
||||||
private String provideAdminEmail;
|
private String provideAdminEmail;
|
||||||
|
|
||||||
@Value("${validator.results.url}")
|
@Value("${services.provide.validator.results.url}")
|
||||||
private String valBaseUrl;
|
private String valBaseUrl;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class PiWikServiceImpl implements PiWikService {
|
||||||
private DataSource dataSource;
|
private DataSource dataSource;
|
||||||
|
|
||||||
|
|
||||||
@Value("${services.repomanager.analyticsURL}")
|
@Value("${services.provide.analyticsURL}")
|
||||||
private String analyticsURL;
|
private String analyticsURL;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ import eu.dnetlib.repo.manager.service.security.RoleMappingService;
|
||||||
import eu.dnetlib.repo.manager.utils.Converter;
|
import eu.dnetlib.repo.manager.utils.Converter;
|
||||||
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.http.entity.ContentType;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@ -34,7 +33,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.MimeType;
|
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
import org.springframework.web.util.UriComponents;
|
import org.springframework.web.util.UriComponents;
|
||||||
|
@ -62,16 +60,16 @@ public class RepositoryServiceImpl implements RepositoryService {
|
||||||
private final EmailUtils emailUtils;
|
private final EmailUtils emailUtils;
|
||||||
private final ValidatorService validatorService;
|
private final ValidatorService validatorService;
|
||||||
|
|
||||||
@Value("${api.baseAddress}")
|
@Value("${services.provide.clients.dsm}")
|
||||||
private String baseAddress;
|
private String baseAddress;
|
||||||
|
|
||||||
@Value("${services.repo-manager.adminEmail}")
|
@Value("${services.provide.adminEmail}")
|
||||||
private String adminEmail;
|
private String adminEmail;
|
||||||
|
|
||||||
@Value("${services.repomanager.usageStatisticsDiagramsBaseURL}")
|
@Value("${services.provide.usageStatisticsDiagramsBaseURL}")
|
||||||
private String usageStatisticsDiagramsBaseURL;
|
private String usageStatisticsDiagramsBaseURL;
|
||||||
|
|
||||||
@Value("${services.repomanager.usageStatisticsNumbersBaseURL}")
|
@Value("${services.provide.usageStatisticsNumbersBaseURL}")
|
||||||
private String usageStatisticsNumbersBaseURL;
|
private String usageStatisticsNumbersBaseURL;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,11 @@ public class StatsServiceImpl implements StatsService {
|
||||||
@Autowired
|
@Autowired
|
||||||
RestTemplate restTemplate;
|
RestTemplate restTemplate;
|
||||||
|
|
||||||
@Value("${search.api.baseAddress}")
|
@Value("${services.provide.clients.search}")
|
||||||
private String baseAddress;
|
private String baseAddress;
|
||||||
@Value("${search.api.usagestats}")
|
@Value("${services.provide.clients.usagestats}")
|
||||||
private String usagestatsBaseAddress;
|
private String usagestatsBaseAddress;
|
||||||
@Value("${search.api.usageEvents}")
|
@Value("${services.provide.clients.usageEvents}")
|
||||||
private String usagestatsEvents;
|
private String usagestatsEvents;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,7 +19,7 @@ import java.util.List;
|
||||||
public class SushiliteServiceImpl implements SushiliteService {
|
public class SushiliteServiceImpl implements SushiliteService {
|
||||||
|
|
||||||
|
|
||||||
@Value("${services.repomanager.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 org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger.getLogger(SushiliteServiceImpl.class);
|
||||||
|
|
|
@ -19,9 +19,6 @@ public class UserServiceImpl implements UserService {
|
||||||
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger
|
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger
|
||||||
.getLogger(UserServiceImpl.class);
|
.getLogger(UserServiceImpl.class);
|
||||||
|
|
||||||
@Value("${oidc.issuer}")
|
|
||||||
private String oidc_issuer;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Object> login() {
|
public ResponseEntity<Object> login() {
|
||||||
OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class RegistryCalls implements AaiRegistryService {
|
||||||
public final RegistryUtils jsonUtils;
|
public final RegistryUtils jsonUtils;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RegistryCalls(@Value("${aai.registry.coid:2}") String coid,
|
RegistryCalls(@Value("${services.provide.aai.registry.coid:2}") String coid,
|
||||||
HttpUtils httpUtils, RegistryUtils registryUtils) {
|
HttpUtils httpUtils, RegistryUtils registryUtils) {
|
||||||
this.coid = coid;
|
this.coid = coid;
|
||||||
this.httpUtils = httpUtils;
|
this.httpUtils = httpUtils;
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class AaiRoleMappingService implements RoleMappingService {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(AaiRoleMappingService.class);
|
private static final Logger logger = Logger.getLogger(AaiRoleMappingService.class);
|
||||||
|
|
||||||
@Value("${aai.registry.production:true}")
|
@Value("${services.provide.aai.registry.production:true}")
|
||||||
private boolean production;
|
private boolean production;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,13 @@ public class HttpUtils {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(HttpUtils.class);
|
private static final Logger logger = Logger.getLogger(HttpUtils.class);
|
||||||
|
|
||||||
@Value("${aai.registry.url}")
|
@Value("${services.provide.aai.registry.url}")
|
||||||
private String registryUrl;
|
private String registryUrl;
|
||||||
|
|
||||||
@Value("${aai.registry.authentication.username}")
|
@Value("${services.provide.aai.registry.username}")
|
||||||
private String user;
|
private String user;
|
||||||
|
|
||||||
@Value("${aai.registry.authentication.password}")
|
@Value("${services.provide.aai.registry.password}")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
public JsonElement post(String path, JsonObject body) {
|
public JsonElement post(String path, JsonObject body) {
|
||||||
|
|
|
@ -1,113 +0,0 @@
|
||||||
#container.hostname = dl114.madgik.di.uoa.gr
|
|
||||||
#container.hostname = mpagasas.di.uoa.gr
|
|
||||||
#container.hostname = adonis.athenarc.gr
|
|
||||||
container.hostname = estella.athenarc.gr
|
|
||||||
|
|
||||||
provider.endpoint=http://estella.athenarc.gr:8480/uoa-repository-manager-service
|
|
||||||
|
|
||||||
|
|
||||||
# EMAIL SETTINGS
|
|
||||||
services.repomanager.mail.host = smtp.gmail.com
|
|
||||||
services.repomanager.mail.port = 465
|
|
||||||
services.repomanager.mail.username = test.openaire@gmail.com
|
|
||||||
services.repomanager.mail.password = ^($*@$)*!$
|
|
||||||
services.repomanager.mail.authenticate = true
|
|
||||||
services.repomanager.mail.debug = false
|
|
||||||
services.repomanager.mail.mode = ssl
|
|
||||||
services.repomanager.mail.from = test.openaire@gmail.com
|
|
||||||
services.repomanager.mail.replyTo = test.openaire@gmail.com
|
|
||||||
|
|
||||||
# IS
|
|
||||||
ISLookUpService.url = https://dev-openaire.d4science.org:443/is/services/isLookUp
|
|
||||||
ValidatorService.url=http://88.197.53.69:8080/uoa-validator-service/services/validatorWebService
|
|
||||||
|
|
||||||
# LDAP
|
|
||||||
#services.validator.ldap.address = 88.197.53.113
|
|
||||||
#services.validator.ldap.address = 194.197.192.119
|
|
||||||
#services.validator.ldap.port = 389
|
|
||||||
#services.validator.ldap.username = cn=admin,dc=openaire,dc=eu
|
|
||||||
#services.validator.ldap.password = serenata
|
|
||||||
#services.validator.ldap.usersDN = ou=users,dc=openaire,dc=eu
|
|
||||||
#
|
|
||||||
#services.users.ldap.address = 194.177.192.119
|
|
||||||
#services.users.ldap.port = 389
|
|
||||||
#services.users.ldap.username = cn=admin,dc=openaire,dc=eu
|
|
||||||
#services.users.ldap.password = serenata
|
|
||||||
#services.users.ldap.usersDN = ou=users,dc=openaire,dc=eu
|
|
||||||
#
|
|
||||||
#services.validator.ldap.address = 194.177.192.119
|
|
||||||
#services.validator.ldap.port = 389
|
|
||||||
#services.validator.ldap.username = cn=admin,dc=openaire,dc=eu
|
|
||||||
#services.validator.ldap.password = serenata
|
|
||||||
#services.validator.ldap.usersDN = ou=users,dc=openaire,dc=eu
|
|
||||||
|
|
||||||
#AAI-REDIS
|
|
||||||
redis.host = localhost
|
|
||||||
redis.port = 6379
|
|
||||||
redis.password = 2106875370
|
|
||||||
|
|
||||||
oidc.dev.home = http://88.197.53.69/api/openid_connect_login
|
|
||||||
webapp.dev.front = http://88.197.53.69/join
|
|
||||||
|
|
||||||
services.repomanager.db.driverClassName=org.postgresql.Driver
|
|
||||||
services.repomanager.db.url=jdbc:postgresql://localhost:5432/repomanager
|
|
||||||
services.repomanager.db.username=dnet
|
|
||||||
services.repomanager.db.password=dnetPwd
|
|
||||||
#infrastructure.name=integration
|
|
||||||
|
|
||||||
#transport.soap.baseAddress=http://${container.hostname}:${container.port}/${container.context}
|
|
||||||
#transport.soap.force.local.address=false
|
|
||||||
#services.validator.mail.host=smtp.gmail.com
|
|
||||||
#services.validator.mail.port=465
|
|
||||||
#services.validator.mail.fromAddress=no-reply@openaire.eu
|
|
||||||
#services.validator.mail.replyToAddress=no-reply@openaire.eu
|
|
||||||
#services.validator.mail.username=test.openaire@gmail.com
|
|
||||||
#services.validator.mail.password=^($*@$)*!$
|
|
||||||
#services.validator.mail.authenticate=true
|
|
||||||
#services.validator.mail.override=false
|
|
||||||
#services.validator.mail.logonly=false
|
|
||||||
#services.validator.mail.mode=ssl
|
|
||||||
#services.validator.mail.debug=false
|
|
||||||
#services.validator.mail.overrideEmail=antleb@di.uoa.gr
|
|
||||||
#services.validator.mail.specialRecipients=antleb@di.uoa.gr
|
|
||||||
#services.validator.repoRegistration.override=antleb@di.uoa.gr
|
|
||||||
|
|
||||||
|
|
||||||
search.api.baseAddress=https://beta.services.openaire.eu/search/v2/api
|
|
||||||
search.api.usagestats=https://services.openaire.eu/usagestats
|
|
||||||
search.api.usageEvents=http://beta.lbs.openaire.eu:8080/ajax/summary
|
|
||||||
api.baseAddress=http://beta.services.openaire.eu/openaire
|
|
||||||
services.repomanager.baseUrl=http://${container.hostname}:${container.port}/${container.context}
|
|
||||||
services.repomanager.usageStatisticsDiagramsBaseURL=https://beta.openaire.eu/stats3/
|
|
||||||
services.repomanager.usageStatisticsNumbersBaseURL=https://beta.services.openaire.eu/usagestats/datasources/
|
|
||||||
services.repomanager.usagestats.adminEmail=antleb@di.uoa.gr
|
|
||||||
services.repomanager.usagestats.sushiliteEndpoint=http://beta.services.openaire.eu/usagestats/sushilite/
|
|
||||||
services.repomanager.analyticsURL=https://analytics.openaire.eu/addsite.php?
|
|
||||||
|
|
||||||
aai.mode=develop
|
|
||||||
|
|
||||||
#uoa-repository-manager-service
|
|
||||||
#oidc.dev.home=http://88.197.53.69:8080/uoa-repository-manager-service/openid_connect_login
|
|
||||||
#webapp.dev.front=http://88.197.53.69/landing
|
|
||||||
|
|
||||||
services.repo-manager.adminEmail=antleb@di.uoa.gr
|
|
||||||
services.repomanager.usagestats.adminEmail=antleb@di.uoa.gr
|
|
||||||
services.repomanager.provide.adminEmail=antleb@di.uoa.gr
|
|
||||||
validator.results.url=https://beta.provide.openaire.eu/compatibility/browseHistory/
|
|
||||||
topic_types.url=https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:topic_types.json
|
|
||||||
services.broker.url=http://broker1-dev-dnet.d4science.org
|
|
||||||
services.broker.port=8080
|
|
||||||
services.broker.api=api/
|
|
||||||
services.broker.openaire=openaireBroker
|
|
||||||
|
|
||||||
oidc.url.base=https://aai.openaire.eu
|
|
||||||
oidc.issuer=${oidc.url.base}/oidc/
|
|
||||||
|
|
||||||
aai.registry.url=${oidc.url.base}/registry/
|
|
||||||
aai.registry.coid=2
|
|
||||||
aai.registry.production=false
|
|
||||||
aai.registry.authentication.username=provide_openaire
|
|
||||||
aai.registry.authentication.password=u8WfYv2R^f#y7G98
|
|
||||||
|
|
||||||
oidc.id=767422b9-5461-4807-a80a-f9a2072d3a7d
|
|
||||||
oidc.secret=AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhnZ_GPUJvhymBhFupdgb6aU
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
services:
|
||||||
|
provide:
|
||||||
|
aai:
|
||||||
|
baseURL: https://aai.openaire.eu
|
||||||
|
oidc:
|
||||||
|
domain: .openaire.eu
|
||||||
|
id: 767422b9-5461-4807-a80a-f9a2072d3a7d
|
||||||
|
issuer: ${services.provide.aai.baseURL}/oidc/
|
||||||
|
redirectURL: http://88.197.53.69/api/openid_connect_login
|
||||||
|
secret: AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhnZ_GPUJvhymBhFupdgb6aU
|
||||||
|
webURL: http://88.197.53.69/join
|
||||||
|
registry:
|
||||||
|
coid: 2
|
||||||
|
password: u8WfYv2R^f#y7G98
|
||||||
|
production: false
|
||||||
|
url: ${services.provide.aai.baseURL}/registry/
|
||||||
|
username: provide_openaire
|
||||||
|
adminEmail: antleb@di.uoa.gr
|
||||||
|
analyticsURL: https://analytics.openaire.eu/addsite.php?
|
||||||
|
baseUrl: https://beta.provide.openaire.eu/
|
||||||
|
broker:
|
||||||
|
api: api/
|
||||||
|
openaire: openaireBroker
|
||||||
|
port: 8080
|
||||||
|
url: http://broker1-dev-dnet.d4science.org
|
||||||
|
clients:
|
||||||
|
dsm: http://beta.services.openaire.eu/openaire
|
||||||
|
search: https://beta.services.openaire.eu/search/v2/api
|
||||||
|
usageEvents: http://beta.lbs.openaire.eu:8080/ajax/summary
|
||||||
|
usagestats: https://services.openaire.eu/usagestats
|
||||||
|
db:
|
||||||
|
driverClassName: org.postgresql.Driver
|
||||||
|
password: dnetPwd
|
||||||
|
url: jdbc:postgresql://localhost:5432/repomanager
|
||||||
|
username: dnet
|
||||||
|
iSLookUpService:
|
||||||
|
url: https://dev-openaire.d4science.org:443/is/services/isLookUp
|
||||||
|
mail:
|
||||||
|
authenticate: true
|
||||||
|
debug: false
|
||||||
|
from: test.openaire@gmail.com
|
||||||
|
host: smtp.gmail.com
|
||||||
|
mode: ssl
|
||||||
|
password: ^($*@$)*!$
|
||||||
|
port: 465
|
||||||
|
replyTo: test.openaire@gmail.com
|
||||||
|
username: test.openaire@gmail.com
|
||||||
|
redis:
|
||||||
|
host: localhost
|
||||||
|
password: 2106875370
|
||||||
|
port: 6379
|
||||||
|
topic_types:
|
||||||
|
url: https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:topic_types.json
|
||||||
|
usageStatisticsDiagramsBaseURL: https://beta.openaire.eu/stats3/
|
||||||
|
usageStatisticsNumbersBaseURL: https://beta.services.openaire.eu/usagestats/datasources/
|
||||||
|
usagestats:
|
||||||
|
adminEmail: antleb@di.uoa.gr
|
||||||
|
sushiliteEndpoint: http://beta.services.openaire.eu/usagestats/sushilite/
|
||||||
|
validator:
|
||||||
|
results:
|
||||||
|
url: https://beta.provide.openaire.eu/compatibility/browseHistory/
|
||||||
|
validatorService:
|
||||||
|
url: http://88.197.53.69:8080/uoa-validator-service/services/validatorWebService
|
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
package unitest;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import eu.dnetlib.repo.manager.config.RepoManagerContextLoaderListener;
|
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
|
||||||
@ContextConfiguration(classes = RepoManagerContextLoaderListener.class)
|
|
||||||
public class PiwikTest {
|
|
||||||
|
|
||||||
String analyticsURL = "https://analytics.openaire.eu/addsite.php?";
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void enableMetricsRepo1(){
|
|
||||||
|
|
||||||
String officialName = "BỘ SƯU TẬP SỐ";
|
|
||||||
String repoWebsite = "http://www.vnulib.edu.vn:8000/dspace/";
|
|
||||||
|
|
||||||
enableMetrics(officialName, repoWebsite, analyticsURL);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void enableMetricsRepo2(){
|
|
||||||
|
|
||||||
String officialName = "ILC4CLARIN repository of language resources and tools";
|
|
||||||
String repoWebsite = "https://dspace-clarin-it.ilc.cnr.it/repository/xmlui";
|
|
||||||
|
|
||||||
enableMetrics(officialName, repoWebsite, analyticsURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void enableMetricsRepo3(){
|
|
||||||
|
|
||||||
String officialName = "ANSTO Publications Online";
|
|
||||||
String repoWebsite = "http://apo.ansto.gov.au/dspace/";
|
|
||||||
|
|
||||||
enableMetrics(officialName, repoWebsite, analyticsURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enableMetrics(String officialName, String repoWebsite, String analyticsURL) {
|
|
||||||
String url;
|
|
||||||
try {
|
|
||||||
url = analyticsURL + "siteName=" + URLEncoder.encode(officialName, "UTF-8") + "&url="
|
|
||||||
+ URLEncoder.encode(repoWebsite, "UTF-8");
|
|
||||||
url = StringEscapeUtils.escapeJava(url);
|
|
||||||
|
|
||||||
Map map = null;
|
|
||||||
String siteId = null;
|
|
||||||
|
|
||||||
URL u = new URL(url);
|
|
||||||
map = new ObjectMapper().readValue(u, Map.class);
|
|
||||||
if(map.get("value")!=null) {
|
|
||||||
siteId = map.get("value").toString();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
|
@ -1,31 +0,0 @@
|
||||||
//package unitest;
|
|
||||||
//
|
|
||||||
//import eu.dnetlib.repo.manager.config.RepoManagerContextLoaderListener;
|
|
||||||
//import eu.dnetlib.repo.manager.utils.OaiTools;
|
|
||||||
//import org.junit.Test;
|
|
||||||
//import org.junit.runner.RunWith;
|
|
||||||
//import org.springframework.test.context.ContextConfiguration;
|
|
||||||
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
//
|
|
||||||
//@RunWith(SpringJUnit4ClassRunner.class)
|
|
||||||
//@ContextConfiguration(classes = RepoManagerContextLoaderListener.class)
|
|
||||||
////@WebAppConfiguration
|
|
||||||
//public class ValidatorTest {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void identiFy(){
|
|
||||||
//
|
|
||||||
// String url = "https://repozitorij.srce.unizg.hr/oai";
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// System.out.println("Identify repository with url : " + url);
|
|
||||||
// try {
|
|
||||||
// System.out.println(OaiTools.identifyRepository(url));
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// System.out.println(e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//}
|
|
Loading…
Reference in New Issue