diff --git a/pom.xml b/pom.xml index b827685..1225f8f 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ eu.dnetlib uoa-repository-manager-service 1.0.0-SNAPSHOT - war + jar 2.5.4 diff --git a/src/main/java/eu/dnetlib/repo/manager/config/AaiSecurityConfiguration.java b/src/main/java/eu/dnetlib/repo/manager/config/AaiSecurityConfiguration.java index 6f4a33d..702e5a9 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/AaiSecurityConfiguration.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/AaiSecurityConfiguration.java @@ -24,22 +24,22 @@ import java.util.*; @EnableWebSecurity public class AaiSecurityConfiguration extends WebSecurityConfigurerAdapter { - @Value("${webapp.dev.front}") + @Value("${services.provide.aai.oidc.webURL}") private String logoutSuccessUrl; - @Value("${oidc.issuer}") + @Value("${services.provide.aai.oidc.issuer}") private String oidcIssuer; - @Value("${oidc.id}") + @Value("${services.provide.aai.oidc.id}") private String oidcId; - @Value("${oidc.secret}") + @Value("${services.provide.aai.oidc.secret}") private String oidcSecret; - @Value("${oidc.dev.home}") + @Value("${services.provide.aai.oidc.redirectURL}") private String oidcDevHome; - @Value("${webapp.dev.front}") + @Value("${services.provide.aai.oidc.webURL}") private String webAppFrontEnd; @Bean diff --git a/src/main/java/eu/dnetlib/repo/manager/config/CascadingPropertyLoader.java b/src/main/java/eu/dnetlib/repo/manager/config/CascadingPropertyLoader.java deleted file mode 100644 index bc0af97..0000000 --- a/src/main/java/eu/dnetlib/repo/manager/config/CascadingPropertyLoader.java +++ /dev/null @@ -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: - * - * - * something = 1 - * somethingelse = 2 - * test = ${something}/${somethingelse} - * - * - *

- * And if you override something to XX, then test will become XX/2 - *

- * - * - * @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; - } -} - diff --git a/src/main/java/eu/dnetlib/repo/manager/config/Config.java b/src/main/java/eu/dnetlib/repo/manager/config/Config.java index cbef70b..6bbf3f9 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/Config.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/Config.java @@ -20,10 +20,10 @@ import org.springframework.context.annotation.*; @Configuration public class Config { - @Value("${ISLookUpService.url}") + @Value("${services.provide.iSLookUpService.url}") private String lookupURL; - @Value("${ValidatorService.url}") + @Value("${services.provide.validatorService.url}") private String validatorUrl; @Bean(name="vocabularyLoader") diff --git a/src/main/java/eu/dnetlib/repo/manager/config/DatasourceConfiguration.java b/src/main/java/eu/dnetlib/repo/manager/config/DatasourceConfiguration.java index 09a38a8..192606f 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/DatasourceConfiguration.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/DatasourceConfiguration.java @@ -14,16 +14,16 @@ public class DatasourceConfiguration { private static Logger LOGGER = Logger.getLogger(DatasourceConfiguration.class); - @Value("${services.repomanager.db.driverClassName}") + @Value("${services.provide.db.driverClassName}") private String driverClassname; - @Value("${services.repomanager.db.url}") + @Value("${services.provide.db.url}") private String URL; - @Value("${services.repomanager.db.username}") + @Value("${services.provide.db.username}") private String username; - @Value("${services.repomanager.db.password}") + @Value("${services.provide.db.password}") private String password; @Bean diff --git a/src/main/java/eu/dnetlib/repo/manager/config/FrontEndLinkURIAuthenticationSuccessHandler.java b/src/main/java/eu/dnetlib/repo/manager/config/FrontEndLinkURIAuthenticationSuccessHandler.java index fc1ec49..99fbf7e 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/FrontEndLinkURIAuthenticationSuccessHandler.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/FrontEndLinkURIAuthenticationSuccessHandler.java @@ -30,8 +30,8 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati } - @Value("${aai.mode}") - private String aai_mode; + @Value("${services.provide.aai.oidc.domain}") + private String domain; @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { @@ -47,8 +47,7 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati } else { accessToken.setMaxAge(3600); } - if (aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta")) - accessToken.setDomain(".openaire.eu"); + accessToken.setDomain(domain); accessToken.setPath("/"); response.addCookie(accessToken); diff --git a/src/main/java/eu/dnetlib/repo/manager/config/MailConfig.java b/src/main/java/eu/dnetlib/repo/manager/config/MailConfig.java index 560d2b6..a979861 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/MailConfig.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/MailConfig.java @@ -8,31 +8,31 @@ import org.springframework.context.annotation.Configuration; @Configuration public class MailConfig { - @Value("${services.repomanager.mail.host}") + @Value("${services.provide.mail.host}") private String host; - @Value("${services.repomanager.mail.port}") + @Value("${services.provide.mail.port}") private int port; - @Value("${services.repomanager.mail.authenticate}") + @Value("${services.provide.mail.authenticate}") private boolean authenticate; - @Value("${services.repomanager.mail.username}") + @Value("${services.provide.mail.username}") private String username; - @Value("${services.repomanager.mail.password}") + @Value("${services.provide.mail.password}") private String password; - @Value("${services.repomanager.mail.from}") + @Value("${services.provide.mail.from}") private String from; - @Value("${services.repomanager.mail.replyTo}") + @Value("${services.provide.mail.replyTo}") private String replyTo; - @Value("${services.repomanager.mail.mode}") + @Value("${services.provide.mail.mode}") private String mode; - @Value("${services.repomanager.mail.debug}") + @Value("${services.provide.mail.debug}") private boolean debug; @Bean diff --git a/src/main/java/eu/dnetlib/repo/manager/config/OpenAIREAuthoritiesMapper.java b/src/main/java/eu/dnetlib/repo/manager/config/OpenAIREAuthoritiesMapper.java index 91bd1ce..57e9a17 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/OpenAIREAuthoritiesMapper.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/OpenAIREAuthoritiesMapper.java @@ -20,7 +20,7 @@ public class OpenAIREAuthoritiesMapper implements OIDCAuthoritiesMapper { private static final Logger logger = Logger.getLogger(OpenAIREAuthoritiesMapper.class); - @Value("${services.repo-manager.adminEmail}") + @Value("${services.provide.adminEmail}") String adminEmail; @Override diff --git a/src/main/java/eu/dnetlib/repo/manager/config/RedisConfiguration.java b/src/main/java/eu/dnetlib/repo/manager/config/RedisConfiguration.java index 5a3ea0a..660a607 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/RedisConfiguration.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/RedisConfiguration.java @@ -15,7 +15,6 @@ import javax.annotation.PostConstruct; @Configuration @EnableRedisHttpSession -@PropertySource(value = {"classpath:application.properties"} ) @ComponentScan(basePackages = { "org.eurocris.openaire.cris.validator.service", "eu.dnetlib.repo.manager.*"}) @@ -23,17 +22,17 @@ public class RedisConfiguration { private static Logger LOGGER = Logger.getLogger(RedisConfiguration.class); - @Value("${redis.host}") + @Value("${services.provide.redis.host}") private String host; - @Value("${redis.port:6379}") + @Value("${services.provide.redis.port:6379}") private String port; - @Value("${redis.password}") + @Value("${services.provide.redis.password}") private String password; - @Value("${aai.mode}") - private String aai_mode; + @Value("${services.provide.aai.oidc.domain}") + private String domain; @PostConstruct private void init(){ @@ -56,9 +55,7 @@ public class RedisConfiguration { DefaultCookieSerializer serializer = new DefaultCookieSerializer(); serializer.setCookieName("openAIRESession"); serializer.setCookiePath("/"); - if(aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta")) - serializer.setDomainName(".openaire.eu"); -// serializer.setDomainName(".athenarc.gr"); + serializer.setDomainName(domain); LOGGER.info("Serializer : " + serializer); return serializer; } diff --git a/src/main/java/eu/dnetlib/repo/manager/config/RepoManagerContextLoaderListener.java b/src/main/java/eu/dnetlib/repo/manager/config/RepoManagerContextLoaderListener.java deleted file mode 100644 index ed14f18..0000000 --- a/src/main/java/eu/dnetlib/repo/manager/config/RepoManagerContextLoaderListener.java +++ /dev/null @@ -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; - } - -} diff --git a/src/main/java/eu/dnetlib/repo/manager/controllers/UserRoleController.java b/src/main/java/eu/dnetlib/repo/manager/controllers/UserRoleController.java index dfed035..eb8bfcf 100644 --- a/src/main/java/eu/dnetlib/repo/manager/controllers/UserRoleController.java +++ b/src/main/java/eu/dnetlib/repo/manager/controllers/UserRoleController.java @@ -18,9 +18,9 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Collection; -@RestController -@RequestMapping(value = "/role-management") -@Api(description = "Role Management", value = "role-management") +//@RestController +//@RequestMapping(value = "/role-management") +//@Api(description = "Role Management", value = "role-management") public class UserRoleController { private final AaiRegistryService aaiRegistryService; diff --git a/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java index c455e26..e3e5a7c 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java @@ -33,11 +33,11 @@ public class BrokerServiceImpl implements BrokerService { @Autowired 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; - @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; - @Value("${topic_types.url}") + @Value("${services.provide.topic_types.url}") private String topicsURL; private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger diff --git a/src/main/java/eu/dnetlib/repo/manager/service/EmailUtilsImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/EmailUtilsImpl.java index 14bced3..bb62b33 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/EmailUtilsImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/EmailUtilsImpl.java @@ -26,16 +26,16 @@ public class EmailUtilsImpl implements EmailUtils { private final MailLibrary mailLibrary; private final RepositoryService repositoryService; - @Value("${services.repomanager.baseUrl}") + @Value("${services.provide.baseUrl}") private String baseUrl; - @Value("${services.repomanager.usagestats.adminEmail}") + @Value("${services.provide.usagestats.adminEmail}") private String usageStatsAdminEmail; - @Value("${services.repomanager.provide.adminEmail}") + @Value("${services.provide.adminEmail}") private String provideAdminEmail; - @Value("${validator.results.url}") + @Value("${services.provide.validator.results.url}") private String valBaseUrl; @Autowired diff --git a/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java index 986765d..f8bcd45 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java @@ -36,7 +36,7 @@ public class PiWikServiceImpl implements PiWikService { private DataSource dataSource; - @Value("${services.repomanager.analyticsURL}") + @Value("${services.provide.analyticsURL}") private String analyticsURL; diff --git a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java index 36192d2..909c612 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java @@ -19,7 +19,6 @@ import eu.dnetlib.repo.manager.service.security.RoleMappingService; import eu.dnetlib.repo.manager.utils.Converter; import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader; import org.apache.commons.codec.digest.DigestUtils; -import org.apache.http.entity.ContentType; import org.apache.log4j.Logger; import org.json.JSONArray; 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.context.SecurityContextHolder; import org.springframework.stereotype.Service; -import org.springframework.util.MimeType; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponents; @@ -62,16 +60,16 @@ public class RepositoryServiceImpl implements RepositoryService { private final EmailUtils emailUtils; private final ValidatorService validatorService; - @Value("${api.baseAddress}") + @Value("${services.provide.clients.dsm}") private String baseAddress; - @Value("${services.repo-manager.adminEmail}") + @Value("${services.provide.adminEmail}") private String adminEmail; - @Value("${services.repomanager.usageStatisticsDiagramsBaseURL}") + @Value("${services.provide.usageStatisticsDiagramsBaseURL}") private String usageStatisticsDiagramsBaseURL; - @Value("${services.repomanager.usageStatisticsNumbersBaseURL}") + @Value("${services.provide.usageStatisticsNumbersBaseURL}") private String usageStatisticsNumbersBaseURL; diff --git a/src/main/java/eu/dnetlib/repo/manager/service/StatsServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/StatsServiceImpl.java index 845ed10..235e9e3 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/StatsServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/StatsServiceImpl.java @@ -15,11 +15,11 @@ public class StatsServiceImpl implements StatsService { @Autowired RestTemplate restTemplate; - @Value("${search.api.baseAddress}") + @Value("${services.provide.clients.search}") private String baseAddress; - @Value("${search.api.usagestats}") + @Value("${services.provide.clients.usagestats}") private String usagestatsBaseAddress; - @Value("${search.api.usageEvents}") + @Value("${services.provide.clients.usageEvents}") private String usagestatsEvents; @Override diff --git a/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java index c7b0a0a..90bb074 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; public class SushiliteServiceImpl implements SushiliteService { - @Value("${services.repomanager.usagestats.sushiliteEndpoint}") + @Value("${services.provide.usagestats.sushiliteEndpoint}") private String usagestatsSushiliteEndpoint; private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger.getLogger(SushiliteServiceImpl.class); diff --git a/src/main/java/eu/dnetlib/repo/manager/service/UserServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/UserServiceImpl.java index 8e736ab..0d3a6fd 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/UserServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/UserServiceImpl.java @@ -19,9 +19,6 @@ public class UserServiceImpl implements UserService { private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger .getLogger(UserServiceImpl.class); - @Value("${oidc.issuer}") - private String oidc_issuer; - @Override public ResponseEntity login() { OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); diff --git a/src/main/java/eu/dnetlib/repo/manager/service/aai/registry/RegistryCalls.java b/src/main/java/eu/dnetlib/repo/manager/service/aai/registry/RegistryCalls.java index bc60e87..f71ffb7 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/aai/registry/RegistryCalls.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/aai/registry/RegistryCalls.java @@ -30,7 +30,7 @@ public class RegistryCalls implements AaiRegistryService { public final RegistryUtils jsonUtils; @Autowired - RegistryCalls(@Value("${aai.registry.coid:2}") String coid, + RegistryCalls(@Value("${services.provide.aai.registry.coid:2}") String coid, HttpUtils httpUtils, RegistryUtils registryUtils) { this.coid = coid; this.httpUtils = httpUtils; diff --git a/src/main/java/eu/dnetlib/repo/manager/service/security/AaiRoleMappingService.java b/src/main/java/eu/dnetlib/repo/manager/service/security/AaiRoleMappingService.java index de89483..2938066 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/security/AaiRoleMappingService.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/security/AaiRoleMappingService.java @@ -16,7 +16,7 @@ public class AaiRoleMappingService implements RoleMappingService { private static final Logger logger = Logger.getLogger(AaiRoleMappingService.class); - @Value("${aai.registry.production:true}") + @Value("${services.provide.aai.registry.production:true}") private boolean production; diff --git a/src/main/java/eu/dnetlib/repo/manager/utils/HttpUtils.java b/src/main/java/eu/dnetlib/repo/manager/utils/HttpUtils.java index 9f2912f..5a05eb3 100644 --- a/src/main/java/eu/dnetlib/repo/manager/utils/HttpUtils.java +++ b/src/main/java/eu/dnetlib/repo/manager/utils/HttpUtils.java @@ -18,13 +18,13 @@ public class HttpUtils { private static final Logger logger = Logger.getLogger(HttpUtils.class); - @Value("${aai.registry.url}") + @Value("${services.provide.aai.registry.url}") private String registryUrl; - @Value("${aai.registry.authentication.username}") + @Value("${services.provide.aai.registry.username}") private String user; - @Value("${aai.registry.authentication.password}") + @Value("${services.provide.aai.registry.password}") private String password; public JsonElement post(String path, JsonObject body) { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index d243c62..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..0b20459 --- /dev/null +++ b/src/main/resources/application.yml @@ -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 diff --git a/src/test/java/unitest/PiwikTest.java b/src/test/java/unitest/PiwikTest.java deleted file mode 100644 index 3b55e6b..0000000 --- a/src/test/java/unitest/PiwikTest.java +++ /dev/null @@ -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(); - } - } -}*/ diff --git a/src/test/java/unitest/ValidatorTest.java b/src/test/java/unitest/ValidatorTest.java deleted file mode 100644 index 3c5ce65..0000000 --- a/src/test/java/unitest/ValidatorTest.java +++ /dev/null @@ -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); -// } -// } -// -// -//}