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
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@
</fileset>
</copy>

<copy file="${commons-codec-1.9.jar}" todir="${jboss.home}/server/${server.name}/lib" overwrite="true"/>
<copy file="${commons-codec-1.9.jar}" tofile="${jboss.home}/server/${server.name}/lib/commons-codec.jar" overwrite="true"/>
<copy todir="${jboss.home}/server/${server.name}/lib" flatten="true" overwrite="true">
<fileset dir="${ext_libdir}">
<include name="aws-java-sdk/aws-java-sdk-1.0.004.jar" />
Expand Down
2 changes: 1 addition & 1 deletion conf/ApplicationServer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ SSO_COOKIE_KEY = @ApplicationServer.SSO_COOKIE_KEY@
SSO_HASH_SECRET = @ApplicationServer.SSO_HASH_SECRET@
SSO_DOMAIN = @ApplicationServer.SSO_DOMAIN@

JWT_COOKIE_KEY = @ApplicationServer.JWT_COOKIE_KEY@
JWT_V3_COOKIE_KEY = @ApplicationServer.JWT_V3_COOKIE_KEY@
JWT_COOKIE_KEY = @ApplicationServer.JWT_COOKIE_KEY@
1 change: 1 addition & 0 deletions conf/Direct.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ LDAP_AUTH0_CONNECTION_NAME = @LDAP_AUTH0_CONNECTION_NAME@
REDIRECT_URL_AUTH0 = /reg2/callback.action
REG_SERVER_NAME= @REG_SERVER_NAME@
JWT_VALID_ISSUERS=@JWT_VALID_ISSUERS@
JWT_V3_SECRET = @JWT_V3_SECRET@

#Parameter whether we use login processor or not
USE_LOGIN_PROCESSOR = @useLoginProcessor@
9 changes: 1 addition & 8 deletions conf/web/WEB-INF/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
<property name="loginPageName" value="anonymous"/>
<property name="userSessionIdentityKey" value="user"/>
<property name="redirectBackUrlIdentityKey" value="redirectBackUrl"/>
<property name="authorizationURL" value="@authorizationUrl@"/>
</bean>

<!-- LoggingInterceptor -->
Expand Down Expand Up @@ -340,7 +341,6 @@
<property name="contestFeeService" ref="contestFeeService"/>
<property name="contestFeePercentageService" ref="contestFeePercentageService"/>
<property name="userGroupsApiEndpoint" value="@userGroupsApiEndpoint@"/>
<property name="jwtTokenUpdater" ref="jwtTokenUpdater" />
</bean>

<bean id="projectAction" class="com.topcoder.direct.services.view.action.contest.launch.ProjectAction"
Expand Down Expand Up @@ -1504,13 +1504,11 @@
class="com.topcoder.direct.services.view.action.my.MyCreatedChallengesAction" scope="prototype">
<property name="serviceURL" value="@directChallengeServicesApiUrl@"/>
<property name="userService" ref="userService"/>
<property name="jwtTokenUpdater" ref="jwtTokenUpdater"/>
</bean>

<bean id="myChallengesAction"
class="com.topcoder.direct.services.view.action.my.MyChallengesAction" scope="prototype">
<property name="serviceURL" value="@directChallengeServicesApiUrl@"/>
<property name="jwtTokenUpdater" ref="jwtTokenUpdater"/>
</bean>

<bean id="xmlPhaseTemplatePersistence"
Expand Down Expand Up @@ -1555,10 +1553,5 @@
<bean id="getGroupMemberAction" class="com.topcoder.direct.services.view.action.contest.launch.GetGroupMemberAction"
scope="prototype" parent="baseDirectStrutsAction">
<property name="groupApiEndpoint" value="@groupMemberApiUrl@"/>
<property name="jwtTokenUpdater" ref="jwtTokenUpdater"/>
</bean>
<bean id="jwtTokenUpdater" class="com.topcoder.direct.services.view.util.JwtTokenUpdater" scope="prototype">
<property name="ssoLoginUrl" value="@ssoLoginUrl@"/>
<property name="authorizationURL" value="@authorizationUrl@"/>
</bean>
</beans>
2 changes: 0 additions & 2 deletions conf/web/WEB-INF/struts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1548,15 +1548,13 @@
<package name="my" namespace="/my" extends="base">
<action name="createdChallenges" class="myCreatedChallengesAction">
<result name="success">/WEB-INF/my/myCreatedChallenges.jsp</result>
<result name="forward" type="redirect">${ssoLoginUrl}</result>
</action>
<action name="getCreatedChallenges" method="getMyCreatedChallenges" class="myCreatedChallengesAction">
<result name="success" type="json"/>
<result name="error" type="json"/>
</action>
<action name="challenges" class="myChallengesAction">
<result name="success">/WEB-INF/my/myChallenges.jsp</result>
<result name="forward" type="redirect">${ssoLoginUrl}</result>
</action>
<action name="getMyChallenges" method="getMyChallenges" class="myChallengesAction">
<result name="success" type="json"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ServerConfiguration extends ApplicationServer {
*
* @since 1.1
*/
public static String JWT_COOOKIE_KEY = bundle.getProperty("JWT_COOKIE_KEY", "tcjwt");

public static String JWT_V3_COOKIE_KEY = bundle.getProperty("JWT_V3_COOKIE_KEY", "v3jwt");

public static String JWT_COOKIE_KEY = bundle.getProperty("JWT_COOKIE_KEY", "tcjwt");
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
*/
package com.topcoder.direct.services.view.action;

import com.topcoder.direct.services.configs.ServerConfiguration;
import com.topcoder.direct.services.view.dto.contest.ContestStatus;
import com.topcoder.direct.services.view.dto.project.ProjectBriefDTO;
import com.topcoder.direct.services.view.util.DataProvider;
import com.topcoder.direct.services.view.util.DirectUtils;
import com.topcoder.direct.services.view.util.JwtTokenUpdater;
import com.topcoder.security.TCSubject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
Expand All @@ -17,6 +17,7 @@
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
Expand Down Expand Up @@ -215,11 +216,6 @@ public abstract class ServiceBackendDataTablesAction extends AbstractAction {
*/
protected static final ObjectMapper objectMapper;

/**
* JwtTokenUpdater
*/
private JwtTokenUpdater jwtTokenUpdater;

/**
* <p>A static <code>Map</code> mapping the existing contest statuses to their textual presentations.</p>
*
Expand Down Expand Up @@ -323,7 +319,8 @@ protected JsonNode getJsonResultFromAPI(URI apiEndPoint) throws Exception {
// specify the get request
HttpGet getRequest = new HttpGet(apiEndPoint);

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

getRequest.setHeader(HttpHeaders.AUTHORIZATION,
"Bearer " + token);
Expand Down Expand Up @@ -702,12 +699,4 @@ public String getEndDateTo() {
public void setEndDateTo(String endDateTo) {
this.endDateTo = endDateTo;
}

public JwtTokenUpdater getJwtTokenUpdater() {
return jwtTokenUpdater;
}

public void setJwtTokenUpdater(JwtTokenUpdater jwtTokenUpdater) {
this.jwtTokenUpdater = jwtTokenUpdater;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.topcoder.direct.services.view.util.AuthorizationProvider;
import com.topcoder.direct.services.view.util.DataProvider;
import com.topcoder.direct.services.view.util.DirectUtils;
import com.topcoder.direct.services.view.util.JwtTokenUpdater;
import com.topcoder.direct.services.view.util.challenge.CostCalculationService;
import com.topcoder.management.project.ProjectGroup;
import com.topcoder.security.TCSubject;
Expand Down Expand Up @@ -129,7 +128,6 @@ public class CommonAction extends BaseContestFeeAction {
*/
private String userGroupsApiEndpoint;

private JwtTokenUpdater jwtTokenUpdater;

/**
* <p>
Expand Down Expand Up @@ -561,7 +559,7 @@ public void setCategoryId(long categoryId) {
public String getGroups() {
try {
TCSubject tcSubject = DirectUtils.getTCSubjectFromSession();
Set<ProjectGroup> projectGroups = DirectUtils.getGroups(tcSubject, jwtTokenUpdater, userGroupsApiEndpoint);
Set<ProjectGroup> projectGroups = DirectUtils.getGroups(tcSubject, userGroupsApiEndpoint);
setResult(projectGroups);
} catch (Throwable e) {
if (getModel() != null) {
Expand All @@ -578,12 +576,4 @@ public String getUserGroupsApiEndpoint() {
public void setUserGroupsApiEndpoint(String userGroupsApiEndpoint) {
this.userGroupsApiEndpoint = userGroupsApiEndpoint;
}

public JwtTokenUpdater getJwtTokenUpdater() {
return jwtTokenUpdater;
}

public void setJwtTokenUpdater(JwtTokenUpdater jwtTokenUpdater) {
this.jwtTokenUpdater = jwtTokenUpdater;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import com.topcoder.direct.services.configs.ServerConfiguration;
import com.topcoder.direct.services.view.dto.contest.GroupMember;
import com.topcoder.direct.services.view.dto.my.RestResult;
import com.topcoder.direct.services.view.exception.JwtAuthenticationException;
import com.topcoder.direct.services.view.util.DirectUtils;
import com.topcoder.direct.services.view.util.JwtTokenUpdater;
import com.topcoder.direct.services.view.util.SortedCacheAddress;
import com.topcoder.web.common.cache.CacheClient;
import com.topcoder.web.common.cache.CacheClientFactory;
Expand All @@ -27,9 +25,13 @@
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;

import javax.servlet.http.Cookie;
import java.net.URI;
import java.util.*;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;

/**
* This action handle group member search for given list of groups and substringof user's handle
Expand Down Expand Up @@ -62,11 +64,6 @@ class GetGroupMemberAction extends ContestAction {
*/
private String handle;

/**
* JwtTokenUpdater
*/
private JwtTokenUpdater jwtTokenUpdater;

/**
* Json object mapper
*/
Expand Down Expand Up @@ -188,13 +185,8 @@ private RestResult<GroupMember> getGroupMemberByGid(Long gid) throws Exception {
try{
URI groupApiEndpointUri = new URI(String.format(groupApiEndpoint, gid));
HttpGet request = new HttpGet(groupApiEndpointUri);
String jwtToken;
try{
jwtToken = jwtTokenUpdater.getV3Token();
} catch (Exception e) {
logger.error("Can't get jwt token");
throw e;
}
String jwtToken = DirectUtils.getCookieFromRequest(ServletActionContext.getRequest(),
ServerConfiguration.JWT_V3_COOKIE_KEY).getValue();

request.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + jwtToken);
request.addHeader(HttpHeaders.ACCEPT, "application/json");
Expand Down Expand Up @@ -239,12 +231,4 @@ public String getHandle() {
public void setHandle(String handle) {
this.handle = handle;
}

public JwtTokenUpdater getJwtTokenUpdater() {
return jwtTokenUpdater;
}

public void setJwtTokenUpdater(JwtTokenUpdater jwtTokenUpdater) {
this.jwtTokenUpdater = jwtTokenUpdater;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
*/
package com.topcoder.direct.services.view.action.my;

import com.topcoder.direct.services.configs.ServerConfiguration;
import com.topcoder.direct.services.view.action.ServiceBackendDataTablesAction;
import com.topcoder.direct.services.view.dto.my.Challenge;
import com.topcoder.direct.services.view.dto.my.RestResult;
import com.topcoder.direct.services.view.util.DirectUtils;
import org.codehaus.jackson.JsonNode;

import org.apache.struts2.ServletActionContext;

import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

/**
* <p>
Expand Down Expand Up @@ -49,10 +50,6 @@ public class MyChallengesAction extends ServiceBackendDataTablesAction {
*/
@Override
public String execute() throws Exception {
if (DirectUtils.getCookieFromRequest(ServletActionContext.getRequest(),
ServerConfiguration.JWT_COOOKIE_KEY) == null)
return "forward";

// populate filter data
this.setupFilterPanel();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
* Copyright (C) 2014 TopCoder Inc., All Rights Reserved.
*/
package com.topcoder.direct.services.view.action.my;

import com.topcoder.direct.services.configs.ServerConfiguration;
import com.topcoder.direct.services.view.action.ServiceBackendDataTablesAction;
import com.topcoder.direct.services.view.dto.my.Challenge;
import com.topcoder.direct.services.view.dto.my.RestResult;
import com.topcoder.direct.services.view.util.DirectUtils;
import com.topcoder.service.user.UserService;
import org.apache.struts2.ServletActionContext;
import org.codehaus.jackson.JsonNode;

import java.text.DateFormat;
Expand Down Expand Up @@ -60,10 +57,6 @@ public class MyCreatedChallengesAction extends ServiceBackendDataTablesAction {
*/
@Override
public String execute() throws Exception {
if (DirectUtils.getCookieFromRequest(ServletActionContext.getRequest(),
ServerConfiguration.JWT_COOOKIE_KEY) == null)
return "forward";

// populate filter data
this.setupFilterPanel();

Expand Down

This file was deleted.

Loading