Skip to content

Commit 65a8dff

Browse files
authored
Merge pull request #6712 from ORCID/SplitPropFiles
Split prop files
2 parents d46d626 + 8d2ad89 commit 65a8dff

283 files changed

Lines changed: 1218 additions & 1937 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DEVSETUP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Do this before the '-vmargs' param
172172

173173
* In VM Arguments add the following
174174

175-
-Dorg.orcid.config.file=classpath:staging-persistence.properties -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Dcom.mailgun.testmode=no -Dorg.orcid.message-listener.properties=classpath:message-listener.properties -Dorg.orcid.message-listener.development_mode=true -Dorg.orcid.activemq.config.file=classpath:orcid-activemq.properties
175+
-Dorg.orcid.config.file=[PATH_TO_PROJECT]/properties/development.properties -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Dorg.orcid.message-listener.properties=classpath:message-listener.properties -Dorg.orcid.message-listener.development_mode=true -Dorg.orcid.activemq.config.file=classpath:orcid-activemq.properties
176176

177177
* Click Ok
178178

orcid-api-common/src/main/resources/orcid-oauth2-api-common-config.xml

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,74 @@
44
xsi:schemaLocation="
55
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
66
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
7-
7+
8+
<!-- Message converters -->
9+
<bean id="orcidJsonMessageConverter"
10+
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
11+
<property name="supportedMediaTypes">
12+
<list value-type="org.springframework.http.MediaType">
13+
<bean class="org.springframework.http.MediaType">
14+
<constructor-arg type="java.lang.String" value="application" />
15+
<constructor-arg type="java.lang.String" value="json" />
16+
</bean>
17+
<bean class="org.springframework.http.MediaType">
18+
<constructor-arg type="java.lang.String" value="application" />
19+
<constructor-arg type="java.lang.String" value="orcid+json" />
20+
</bean>
21+
<bean class="org.springframework.http.MediaType">
22+
<constructor-arg type="java.lang.String" value="application" />
23+
<constructor-arg type="java.lang.String" value="vnd.orcid+json" />
24+
</bean>
25+
</list>
26+
</property>
27+
<property name="prettyPrint" value="true" />
28+
</bean>
29+
30+
<bean id="orcidXmlMessageConverter"
31+
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
32+
<property name="supportedMediaTypes">
33+
<list value-type="org.springframework.http.MediaType">
34+
<bean class="org.springframework.http.MediaType">
35+
<constructor-arg type="java.lang.String" value="application" />
36+
<constructor-arg type="java.lang.String" value="xml" />
37+
</bean>
38+
<bean class="org.springframework.http.MediaType">
39+
<constructor-arg type="java.lang.String" value="application" />
40+
<constructor-arg type="java.lang.String" value="orcid+xml" />
41+
</bean>
42+
<bean class="org.springframework.http.MediaType">
43+
<constructor-arg type="java.lang.String" value="application" />
44+
<constructor-arg type="java.lang.String" value="vnd.orcid+xml" />
45+
</bean>
46+
</list>
47+
</property>
48+
</bean>
49+
50+
<!-- OAUTH2 common configuration -->
51+
<bean id="oauthAccessDeniedHandler"
52+
class="org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler">
53+
<property name="exceptionRenderer" ref="oauthExceptionRenderer" />
54+
</bean>
55+
56+
<bean id="oauthExceptionRenderer"
57+
class="org.springframework.security.oauth2.provider.error.DefaultOAuth2ExceptionRenderer">
58+
<property name="messageConverters">
59+
<list>
60+
<ref bean="orcidJsonMessageConverter" />
61+
<ref bean="orcidXmlMessageConverter" />
62+
</list>
63+
</property>
64+
</bean>
65+
66+
<bean id="orcidClientCredentialsChecker" class="org.orcid.core.oauth.OrcidClientCredentialsChecker">
67+
<constructor-arg ref="oAuth2RequestFactory" />
68+
</bean>
69+
70+
<!-- An extension of RandomValueAuthorizationCodeServices to create and
71+
remove authorisation codes -->
72+
<bean id="orcidAuthorizationCodeService"
73+
class="org.orcid.core.oauth.service.OrcidAuthorizationCodeServiceImpl" />
74+
875
<!-- As we have a Jersey endpoint, we need to create an extension to the
976
Spring MVC, so we use a delegator -->
1077
<bean id="orcidClientCredentialEndPointDelegator"
@@ -13,6 +80,43 @@
1380
<property name="clientDetailsService" ref="clientDetailsManager" />
1481
</bean>
1582

83+
<bean id="oAuth2RequestFactory"
84+
class="org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory">
85+
<constructor-arg ref="clientDetailsManager" />
86+
</bean>
87+
88+
<bean id="orcidRefreshTokenChecker" class="org.orcid.core.oauth.OrcidRefreshTokenChecker" />
89+
90+
<!-- TODO: code for token granters should be moved from the orcid-core to the orcid-api-common package -->
91+
<!-- A token granter for the client credentials -->
92+
<bean id="clientCredentialsTokenGranter" class="org.orcid.core.oauth.OrcidClientCredentialsTokenGranter">
93+
<constructor-arg ref="tokenServices" />
94+
<constructor-arg ref="orcidClientCredentialsChecker" />
95+
</bean>
96+
97+
<!-- The 'granter responsible for returning and removing the auth codes -->
98+
<bean id="authorizationCodeTokenGranter" class="org.orcid.core.oauth.OrcidAuthorizationCodeTokenGranter">
99+
<constructor-arg ref="orcidAuthorizationCodeService" />
100+
<constructor-arg ref="tokenServices" />
101+
<constructor-arg ref="clientDetailsManager" />
102+
<constructor-arg ref="oAuth2RequestFactory" />
103+
</bean>
104+
105+
<bean id="orcidImplicitTokenGranter" class="org.orcid.core.oauth.OrcidImplicitTokenGranter">
106+
<constructor-arg ref="tokenServices" />
107+
<constructor-arg ref="clientDetailsManager" />
108+
<constructor-arg ref="oAuth2RequestFactory" />
109+
</bean>
110+
111+
<bean id="refreshTokenTokenGranter" class="org.orcid.core.oauth.OrcidRefreshTokenTokenGranter">
112+
<constructor-arg ref="orcidRefreshTokenChecker" />
113+
<constructor-arg ref="tokenServices" />
114+
</bean>
115+
116+
<bean id="ietfExchangeTokenGranter" class="org.orcid.core.oauth.IETFExchangeTokenGranter">
117+
<constructor-arg ref="tokenServices" />
118+
</bean>
119+
16120
<!-- Use the composite granter to enable granting of tokens for both client
17121
credentials and auth codes -->
18122
<bean id="tokenGranter"
@@ -26,5 +130,5 @@
26130
<ref bean="orcidImplicitTokenGranter" />
27131
</list>
28132
</constructor-arg>
29-
</bean>
133+
</bean>
30134
</beans>

orcid-api-common/src/test/java/org/orcid/api/common/analytics/APIEndpointParserTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import javax.ws.rs.core.HttpHeaders;
1010

1111
import org.junit.Test;
12-
import org.orcid.api.common.analytics.APIEndpointParser;
1312

1413
import com.sun.jersey.core.header.InBoundHeaders;
1514
import com.sun.jersey.server.impl.application.WebApplicationImpl;

orcid-api-common/src/test/java/org/orcid/api/common/analytics/AnalyticsProcessTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import com.sun.jersey.spi.container.ContainerResponse;
3535

3636
@RunWith(OrcidJUnit4ClassRunner.class)
37-
@ContextConfiguration(locations = { "classpath:orcid-core-context.xml" })
37+
@ContextConfiguration(locations = { "classpath:test-orcid-api-common-context.xml" })
3838
public class AnalyticsProcessTest {
3939

4040
@Mock

orcid-api-common/src/test/java/org/orcid/api/common/oauth/OrcidClientCredentialEndPointDelegatorTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.mockito.Mock;
2424
import org.mockito.Mockito;
2525
import org.mockito.MockitoAnnotations;
26-
import org.orcid.api.common.oauth.OrcidClientCredentialEndPointDelegator;
2726
import org.orcid.core.oauth.openid.OpenIDConnectKeyService;
2827
import org.orcid.core.utils.SecurityContextTestUtils;
2928
import org.orcid.jaxb.model.message.ScopePathType;
@@ -46,7 +45,7 @@
4645
import com.sun.jersey.core.util.MultivaluedMapImpl;
4746

4847
@RunWith(OrcidJUnit4ClassRunner.class)
49-
@ContextConfiguration(locations = { "classpath:orcid-core-context.xml", "classpath:orcid-oauth2-common-config.xml", "classpath*:orcid-oauth2-api-common-config.xml", "classpath:orcid-persistence-context.xml"})
48+
@ContextConfiguration(locations = { "classpath:test-orcid-api-common-context.xml"})
5049
public class OrcidClientCredentialEndPointDelegatorTest extends DBUnitTest {
5150

5251
private static final String CLIENT_ID_1 = "APP-5555555555555555";

orcid-core/src/test/java/org/orcid/core/oauth/OrcidRefreshTokenTokenGranterTest.java renamed to orcid-api-common/src/test/java/org/orcid/api/common/oauth/OrcidRefreshTokenTokenGranterTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.orcid.core.oauth;
1+
package org.orcid.api.common.oauth;
22

33
import static org.junit.Assert.assertEquals;
44
import static org.junit.Assert.assertFalse;
@@ -22,6 +22,8 @@
2222
import org.junit.Test;
2323
import org.junit.runner.RunWith;
2424
import org.orcid.core.constants.OrcidOauth2Constants;
25+
import org.orcid.core.oauth.OrcidOauth2TokenDetailService;
26+
import org.orcid.core.oauth.OrcidRefreshTokenTokenGranter;
2527
import org.orcid.persistence.dao.OrcidOauth2TokenDetailDao;
2628
import org.orcid.persistence.jpa.entities.OrcidOauth2TokenDetail;
2729
import org.orcid.persistence.jpa.entities.ProfileEntity;
@@ -36,7 +38,7 @@
3638
import org.springframework.test.context.ContextConfiguration;
3739

3840
@RunWith(OrcidJUnit4ClassRunner.class)
39-
@ContextConfiguration(locations = { "classpath:orcid-core-context.xml", "classpath:orcid-oauth2-common-config.xml", "classpath*:orcid-oauth2-api-common-config.xml" })
41+
@ContextConfiguration(locations = { "classpath:test-orcid-api-common-context.xml" })
4042
public class OrcidRefreshTokenTokenGranterTest extends DBUnitTest {
4143

4244
private static final String CLIENT_ID_1 = "APP-5555555555555555";

orcid-web/src/test/resources/test-orcid-frontend-web-servlet.xml renamed to orcid-api-common/src/test/resources/test-core-context.xml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@
66
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
77
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
88

9-
<!-- <import resource="classpath*:orcid-frontend-web-servlet.xml" /> -->
10-
<context:property-placeholder file-encoding="UTF-8" location="classpath:test-orcid-frontend-web.properties" />
11-
12-
<bean name="webDriverHelper" class="org.orcid.frontend.forms.registration.test.WebDriverHelper">
13-
<property name="baseUrl" value="${org.orcid.web.base.url}" />
14-
<property name="webDriver" ref="webDriver" />
15-
</bean>
16-
17-
<bean name="webDriver" class="org.openqa.selenium.htmlunit.HtmlUnitDriver"/>
18-
9+
<context:property-placeholder
10+
location="classpath:/properties/*.properties"
11+
ignore-resource-not-found="true"
12+
ignore-unresolvable="true" />
1913

14+
<import resource="classpath*:orcid-core-context.xml"/>
2015
</beans>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<beans xmlns="http://www.springframework.org/schema/beans"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:jms="http://www.springframework.org/schema/jms"
5+
xmlns:context="http://www.springframework.org/schema/context"
6+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
7+
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
8+
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-4.3.xsd">
9+
10+
<context:property-placeholder
11+
location="classpath:/properties/test-core.properties,classpath:/properties/test-db.properties"
12+
ignore-resource-not-found="true"
13+
ignore-unresolvable="true" />
14+
15+
<import resource="classpath*:orcid-core-context.xml"/>
16+
<import resource="classpath*:orcid-oauth2-api-common-config.xml"/>
17+
18+
</beans>

orcid-api-web/src/main/resources/orcid-api-security-context.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-5.6.xsd
88
http://www.springframework.org/schema/security/oauth2 https://raw.githubusercontent.com/spring-attic/spring-security-oauth/main/spring-security-oauth2/src/main/resources/org/springframework/security/oauth2/spring-security-oauth2-2.0.xsd">
99

10-
<import resource="classpath*:orcid-oauth2-common-config.xml"/>
1110
<import resource="classpath*:orcid-oauth2-api-common-config.xml"/>
1211

1312
<sec:http-firewall ref="httpFirewall"/>

orcid-api-web/src/main/resources/orcid-api-web-context.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
88
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">
99

10+
<context:property-placeholder location="\${org.orcid.config.file}" ignore-resource-not-found="true" ignore-unresolvable="true" />
11+
1012
<import resource="classpath*:orcid-core-context.xml"/>
13+
<import resource="classpath*:orcid-api-security-context.xml"/>
1114

1215
<context:component-scan base-package="org.orcid.api.common, org.orcid.api.member.common, org.orcid.core.security, org.orcid.api.filters"/>
1316
<aop:aspectj-autoproxy />

0 commit comments

Comments
 (0)