Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit cee9a53

Browse files
committed
add token.properties for issuers
1 parent bbb31ca commit cee9a53

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

conf/Direct.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ JWT_EXPIRATION_SECONDS = @JWT_EXPIRATION_SECONDS@
1717
LDAP_AUTH0_CONNECTION_NAME = @LDAP_AUTH0_CONNECTION_NAME@
1818
REDIRECT_URL_AUTH0 = /reg2/callback.action
1919
REG_SERVER_NAME= @REG_SERVER_NAME@
20+
JWT_VALID_ISSUERS=@JWT_VALID_ISSUERS@
2021

2122
#Parameter whether we use login processor or not
2223
USE_LOGIN_PROCESSOR = @useLoginProcessor@

src/java/main/com/topcoder/direct/services/view/interceptors/AuthenticationInterceptor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,7 @@ public String intercept(ActionInvocation invocation) throws Exception {
292292

293293
JWTToken jwtToken = null;
294294
try {
295-
String[] knownIssuers = new String[]{ "https://" + DirectProperties.DOMAIN_AUTH0 };
296-
jwtToken = new JWTToken(jwtCookie.getValue(),DirectProperties.CLIENT_SECRET_AUTH0, Arrays.asList(knownIssuers));
295+
jwtToken = new JWTToken(jwtCookie.getValue(),DirectProperties.CLIENT_SECRET_AUTH0, DirectProperties.JWT_VALID_ISSUERS);
297296
} catch (TokenExpiredException e) {
298297
//refresh token here
299298
//redirect to loginpage for now

src/java/main/com/topcoder/direct/services/view/util/DirectProperties.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ public final class DirectProperties {
138138
*/
139139
public static String USE_LOGIN_PROCESSOR;
140140

141+
/**
142+
* List of known JWT issuers
143+
*/
144+
public static String JWT_VALID_ISSUERS;
145+
141146
/**
142147
* <p>
143148
* Initializes non-final static fields for this class with values for the same-named properties from the resource

src/java/main/com/topcoder/direct/services/view/util/jwt/JWTToken.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ public class JWTToken {
7474
*
7575
* @param token token
7676
* @param secret secret, if algorithm required it
77-
* @param knownIssuers list of known issuers
77+
* @param knownIssuers comma separate known issuers
7878
* @throws JWTException
7979
*/
80-
public JWTToken(String token, String secret, List<String> knownIssuers) throws JWTException{
80+
public JWTToken(String token, String secret, String knownIssuers) throws JWTException{
8181
if (token == null) {
8282
logger.error("token can not be null");
8383
throw new IllegalArgumentException("token can not be null");
@@ -87,7 +87,10 @@ public JWTToken(String token, String secret, List<String> knownIssuers) throws J
8787
throw new IllegalArgumentException("issuers can not be null");
8888
}
8989

90-
this.knownIssuers = knownIssuers;
90+
for (String issuer : knownIssuers.split("\\s*,\\s*")) {
91+
this.knownIssuers.add(issuer.trim());
92+
}
93+
9194
setTokenAndSecret(token, secret);
9295
}
9396

token.properties.docker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@
326326
@CLIENT_SECRET_AUTH0@ = ZEEIRf_aLhvbYymAMTFefoEJ_8y7ELrUaboMTmE5fQoJXEo7sxxyg8IW6gtbyKuT
327327
@REG_SERVER_NAME@= tc.cloud.topcoder.com
328328
@LDAP_AUTH0_CONNECTION_NAME@=vm-ldap-connection
329-
329+
@JWT_VALID_ISSUERS@ = https://sma.auth0.com, https://newtc.auth0.com
330330

331331
@ApplicationServer.SSO_COOKIE_KEY@=tcsso_vm
332332
@ApplicationServer.SSO_HASH_SECRET@=GKDKJF80dbdc541fe829898aa01d9e30118bab5d6b9fe94fd052a40069385f5628

token.properties.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@
394394
@REG_SERVER_NAME@=tc.cloud.topcoder.com
395395
@LDAP_AUTH0_CONNECTION_NAME@=vm-ldap-connection
396396
@member.profile.url.base@=http://tc.cloud.topcoder.com
397+
@JWT_VALID_ISSUERS@ = https://sma.auth0.com, https://newtc.auth0.com
397398

398399
@memberSearchApiUrl@=https://tc-api.cloud.topcoder.com:8443/v3/members/_suggest/
399400
@groupMemberSearchApiUrl@=https://cockpit.cloud.topcoder.com/direct/group/member?handle=

0 commit comments

Comments
 (0)