-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SWC-7124 - Dynamically set OneSage appId
SWC-7124 - fix comment placement
- Loading branch information
Showing
15 changed files
with
105 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/org/sagebionetworks/web/client/OneSageUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.sagebionetworks.web.client; | ||
|
||
import static org.sagebionetworks.web.shared.WebConstants.ONESAGE_ACCOUNT_SETTINGS_PATH; | ||
|
||
import com.google.gwt.user.client.Window; | ||
import org.sagebionetworks.web.shared.WebConstants; | ||
|
||
public class OneSageUtils { | ||
|
||
private static String getHostForOneSage() { | ||
// SWC-6533: We do not want to stack hop for Prod and Staging | ||
switch (Window.Location.getHostName().toLowerCase()) { | ||
case "staging.synapse.org": | ||
return "https://staging.accounts.synapse.org"; | ||
case "portal-dev.dev.sagebase.org": | ||
return "https://accounts-dev.dev.sagebase.org"; | ||
case "localhost": | ||
case "127.0.0.1": | ||
return "http://" + Window.Location.getHostName() + ":3000"; | ||
default: | ||
return "https://accounts.synapse.org"; | ||
} | ||
} | ||
|
||
public static String getAppIdForOneSage() { | ||
switch (Window.Location.getHostName().toLowerCase()) { | ||
case "staging.synapse.org": | ||
return "staging.synapse.org"; | ||
case "portal-dev.dev.sagebase.org": | ||
return "dev.synapse.org"; | ||
case "localhost": | ||
case "127.0.0.1": | ||
return "localhost"; | ||
default: | ||
return "synapse.org"; | ||
} | ||
} | ||
|
||
public static String getOneSageURL() { | ||
return getOneSageURL("/"); | ||
} | ||
|
||
/** | ||
* Based on the current hostname, generate a URL pointing to an instance of OneSage with an appropriate appId search param. | ||
* @param path | ||
* @return a String representation of the OneSage URL | ||
*/ | ||
public static String getOneSageURL(String path) { | ||
return ( | ||
getHostForOneSage() + | ||
path + | ||
"?" + | ||
WebConstants.ONESAGE_SYNAPSE_APPID_QUERY_PARAM_KEY + | ||
"=" + | ||
getAppIdForOneSage() | ||
); | ||
} | ||
|
||
public static String getAccountSettingsURL() { | ||
return getOneSageURL(ONESAGE_ACCOUNT_SETTINGS_PATH); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters