Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ public class ServerConfiguration extends ApplicationServer {
*
* @since 1.1
*/
public static String JWT_COOKIE_KEY = bundle.getProperty("JWT_COOKIE_KEY", "tcjwt");
public static String JWT_V3_COOKIE_KEY = bundle.getProperty("JWT_V3_COOKIE_KEY", "v3jwt");
}
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ protected JsonNode getJsonResultFromAPI(URI apiEndPoint) throws Exception {
HttpGet getRequest = new HttpGet(apiEndPoint);

String token = DirectUtils.getCookieFromRequest(ServletActionContext.getRequest(),
ServerConfiguration.JWT_COOKIE_KEY).getValue();
ServerConfiguration.JWT_V3_COOKIE_KEY).getValue();

getRequest.setHeader(HttpHeaders.AUTHORIZATION,
"Bearer " + token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private RestResult<GroupMember> getGroupMemberByGid(Long gid) throws Exception {
URI groupApiEndpointUri = new URI(String.format(groupApiEndpoint, gid));
HttpGet request = new HttpGet(groupApiEndpointUri);
String jwtToken = DirectUtils.getCookieFromRequest(ServletActionContext.getRequest(),
ServerConfiguration.JWT_COOKIE_KEY).getValue();
ServerConfiguration.JWT_V3_COOKIE_KEY).getValue();

request.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + jwtToken);
request.addHeader(HttpHeaders.ACCEPT, "application/json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public String intercept(ActionInvocation invocation) throws Exception {
User user = auth.getActiveUser();

Cookie jwtCookie = DirectUtils.getCookieFromRequest(ServletActionContext.getRequest(),
ServerConfiguration.JWT_COOKIE_KEY);
ServerConfiguration.JWT_V3_COOKIE_KEY);

if (jwtCookie == null) {
return loginPageName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void processRequest(LoginAction action) {
// add session cookie, use -1 for expiration time
log.info("Signed JWT: " + sign);
DirectUtils.addDirectCookie(ServletActionContext.getResponse(),
ServerConfiguration.JWT_COOKIE_KEY, sign, -1);
ServerConfiguration.JWT_V3_COOKIE_KEY, sign, -1);

} catch (AuthenticationException e) {
log.error("User " + username + " failed to authenticate successfully due to invalid credentials", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public void processRequest(LoginAction action) {
log.info("SIgned JWT: " + sign);
// add session cookie, use -1 for expiration time
DirectUtils.addDirectCookie(ServletActionContext.getResponse(),
ServerConfiguration.JWT_COOKIE_KEY, sign, -1);
ServerConfiguration.JWT_V3_COOKIE_KEY, sign, -1);
} catch (Exception e) {
log.error("User " + username + " could not set cookie", e);
log.error(e.getMessage() + e.getCause());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3823,7 +3823,7 @@ public static Set<ProjectGroup> getGroupsFromApi(TCSubject tcSubject, String end
HttpGet getRequest = new HttpGet(uri.build());
logger.info("Getting Group with thi uri: " + uri.build().toString());

String v3Token = getCookieFromRequest(getServletRequest(), ServerConfiguration.JWT_COOKIE_KEY).getValue();
String v3Token = getCookieFromRequest(getServletRequest(), ServerConfiguration.JWT_V3_COOKIE_KEY).getValue();

getRequest.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + v3Token);

Expand Down Expand Up @@ -3874,4 +3874,4 @@ public static Set<ProjectGroup> getGroups(TCSubject tcSubject, String endpoint)
}
return projectGroups;
}
}
}
2 changes: 1 addition & 1 deletion token.properties.docker
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
#####################################
# Direct API #
#####################################
@ApplicationServer.JWT_COOKIE_KEY@=tcjwt_vm
@ApplicationServer.JWT_V3_COOKIE_KEY@=v3jwt

@memberSearchApiUrl@=https://tc-api.cloud.topcoder.com:8443/v3/members/_suggest/
@groupMemberSearchApiUrl@=https://cockpit.cloud.topcoder.com/direct/group/member?handle=
Expand Down
4 changes: 2 additions & 2 deletions token.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
@ApplicationServer.SSO_HASH_SECRET@=
@ApplicationServer.SSO_DOMAIN@=topcoder.com

@ApplicationServer.JWT_COOKIE_KEY@=tcjwt
@ApplicationServer.JWT_V3_COOKIE_KEY@=tcjwt

#######################################
# securityGroupApplicationContext.xml #
Expand Down Expand Up @@ -399,4 +399,4 @@
@groupMemberApiUrl@=http://172.18.0.1:8080/v3/groups/%d/members
@directChallengeServicesApiUrl@=http://api.topcoder-dev.com/v3/direct/challenges
@authorizationUrl@=http://api.topcoder-dev.com/v3/authorizations
@userGroupsApiEndpoint@=http://172.18.0.1:8080/v3/groups
@userGroupsApiEndpoint@=http://172.18.0.1:8080/v3/groups