added github test env client id (#1168)
This commit is contained in:
parent
e575b94ffa
commit
6b4d6f986e
|
@ -412,3 +412,11 @@ export class TerminalQueryParams {
|
||||||
public static readonly SubscriptionId = "subscriptionId";
|
public static readonly SubscriptionId = "subscriptionId";
|
||||||
public static readonly TerminalEndpoint = "terminalEndpoint";
|
public static readonly TerminalEndpoint = "terminalEndpoint";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class JunoEndpoints {
|
||||||
|
public static readonly Test = "https://juno-test.documents-dev.windows-int.net";
|
||||||
|
public static readonly Test2 = "https://juno-test2.documents-dev.windows-int.net";
|
||||||
|
public static readonly Test3 = "https://juno-test3.documents-dev.windows-int.net";
|
||||||
|
public static readonly Prod = "https://tools.cosmos.azure.com";
|
||||||
|
public static readonly Stage = "https://tools-staging.cosmos.azure.com";
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { JunoEndpoints } from "Common/Constants";
|
||||||
|
|
||||||
export enum Platform {
|
export enum Platform {
|
||||||
Portal = "Portal",
|
Portal = "Portal",
|
||||||
Hosted = "Hosted",
|
Hosted = "Hosted",
|
||||||
|
@ -23,6 +25,7 @@ export interface ConfigContext {
|
||||||
PROXY_PATH?: string;
|
PROXY_PATH?: string;
|
||||||
JUNO_ENDPOINT: string;
|
JUNO_ENDPOINT: string;
|
||||||
GITHUB_CLIENT_ID: string;
|
GITHUB_CLIENT_ID: string;
|
||||||
|
GITHUB_TEST_ENV_CLIENT_ID: string;
|
||||||
GITHUB_CLIENT_SECRET?: string; // No need to inject secret for prod. Juno already knows it.
|
GITHUB_CLIENT_SECRET?: string; // No need to inject secret for prod. Juno already knows it.
|
||||||
hostedExplorerURL: string;
|
hostedExplorerURL: string;
|
||||||
armAPIVersion?: string;
|
armAPIVersion?: string;
|
||||||
|
@ -52,15 +55,16 @@ let configContext: Readonly<ConfigContext> = {
|
||||||
GRAPH_API_VERSION: "1.6",
|
GRAPH_API_VERSION: "1.6",
|
||||||
ARCADIA_ENDPOINT: "https://workspaceartifacts.projectarcadia.net",
|
ARCADIA_ENDPOINT: "https://workspaceartifacts.projectarcadia.net",
|
||||||
ARCADIA_LIVY_ENDPOINT_DNS_ZONE: "dev.azuresynapse.net",
|
ARCADIA_LIVY_ENDPOINT_DNS_ZONE: "dev.azuresynapse.net",
|
||||||
GITHUB_CLIENT_ID: "6cb2f63cf6f7b5cbdeca", // Registered OAuth app: https://github.com/settings/applications/1189306
|
GITHUB_CLIENT_ID: "6cb2f63cf6f7b5cbdeca", // Registered OAuth app: https://github.com/organizations/AzureCosmosDBNotebooks/settings/applications/1189306
|
||||||
|
GITHUB_TEST_ENV_CLIENT_ID: "b63fc8cbf87fd3c6e2eb", // Registered OAuth app: https://github.com/organizations/AzureCosmosDBNotebooks/settings/applications/1777772
|
||||||
JUNO_ENDPOINT: "https://tools.cosmos.azure.com",
|
JUNO_ENDPOINT: "https://tools.cosmos.azure.com",
|
||||||
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
BACKEND_ENDPOINT: "https://main.documentdb.ext.azure.com",
|
||||||
allowedJunoOrigins: [
|
allowedJunoOrigins: [
|
||||||
"https://juno-test.documents-dev.windows-int.net",
|
JunoEndpoints.Test,
|
||||||
"https://juno-test2.documents-dev.windows-int.net",
|
JunoEndpoints.Test2,
|
||||||
"https://juno-test3.documents-dev.windows-int.net",
|
JunoEndpoints.Test3,
|
||||||
"https://tools.cosmos.azure.com",
|
JunoEndpoints.Prod,
|
||||||
"https://tools-staging.cosmos.azure.com",
|
JunoEndpoints.Stage,
|
||||||
"https://localhost",
|
"https://localhost",
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import ko from "knockout";
|
import ko from "knockout";
|
||||||
import postRobot from "post-robot";
|
import postRobot from "post-robot";
|
||||||
|
import { GetGithubClientId } from "Utils/GitHubUtils";
|
||||||
import { HttpStatusCodes } from "../Common/Constants";
|
import { HttpStatusCodes } from "../Common/Constants";
|
||||||
import { handleError } from "../Common/ErrorHandlingUtils";
|
import { handleError } from "../Common/ErrorHandlingUtils";
|
||||||
import { configContext } from "../ConfigContext";
|
|
||||||
import { AuthorizeAccessComponent } from "../Explorer/Controls/GitHub/AuthorizeAccessComponent";
|
import { AuthorizeAccessComponent } from "../Explorer/Controls/GitHub/AuthorizeAccessComponent";
|
||||||
import { JunoClient } from "../Juno/JunoClient";
|
import { JunoClient } from "../Juno/JunoClient";
|
||||||
import { logConsoleInfo } from "../Utils/NotificationConsoleUtils";
|
import { logConsoleInfo } from "../Utils/NotificationConsoleUtils";
|
||||||
|
@ -55,7 +55,7 @@ export class GitHubOAuthService {
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
scope,
|
scope,
|
||||||
client_id: configContext.GITHUB_CLIENT_ID,
|
client_id: GetGithubClientId(),
|
||||||
redirect_uri: new URL("./connectToGitHub.html", window.location.href).href,
|
redirect_uri: new URL("./connectToGitHub.html", window.location.href).href,
|
||||||
state: this.resetState(),
|
state: this.resetState(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import ko from "knockout";
|
import ko from "knockout";
|
||||||
|
import { GetGithubClientId } from "Utils/GitHubUtils";
|
||||||
import { HttpHeaders, HttpStatusCodes } from "../Common/Constants";
|
import { HttpHeaders, HttpStatusCodes } from "../Common/Constants";
|
||||||
import { configContext } from "../ConfigContext";
|
import { configContext } from "../ConfigContext";
|
||||||
import * as DataModels from "../Contracts/DataModels";
|
import * as DataModels from "../Contracts/DataModels";
|
||||||
|
@ -522,7 +523,7 @@ export class JunoClient {
|
||||||
|
|
||||||
private static getGitHubClientParams(): URLSearchParams {
|
private static getGitHubClientParams(): URLSearchParams {
|
||||||
const githubParams = new URLSearchParams({
|
const githubParams = new URLSearchParams({
|
||||||
client_id: configContext.GITHUB_CLIENT_ID,
|
client_id: GetGithubClientId(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (configContext.GITHUB_CLIENT_SECRET) {
|
if (configContext.GITHUB_CLIENT_SECRET) {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
// https://github.com/<owner>/<repo>/tree/<branch>
|
// https://github.com/<owner>/<repo>/tree/<branch>
|
||||||
|
|
||||||
|
import { JunoEndpoints } from "Common/Constants";
|
||||||
|
import { configContext } from "ConfigContext";
|
||||||
|
import { userContext } from "UserContext";
|
||||||
|
|
||||||
// The url when users visit a repo/branch on github.com
|
// The url when users visit a repo/branch on github.com
|
||||||
export const RepoUriPattern = /https:\/\/github.com\/([^/]*)\/([^/]*)\/tree\/([^?]*)/;
|
export const RepoUriPattern = /https:\/\/github.com\/([^/]*)\/([^/]*)\/tree\/([^?]*)/;
|
||||||
|
|
||||||
|
@ -60,3 +65,15 @@ export function toContentUri(owner: string, repo: string, branch: string, path:
|
||||||
export function toRawContentUri(owner: string, repo: string, branch: string, path: string): string {
|
export function toRawContentUri(owner: string, repo: string, branch: string, path: string): string {
|
||||||
return `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${path}`;
|
return `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${path}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function GetGithubClientId(): string {
|
||||||
|
const junoEndpoint = userContext.features.junoEndpoint ?? configContext.JUNO_ENDPOINT;
|
||||||
|
if (
|
||||||
|
junoEndpoint === JunoEndpoints.Test ||
|
||||||
|
junoEndpoint === JunoEndpoints.Test2 ||
|
||||||
|
junoEndpoint === JunoEndpoints.Test3
|
||||||
|
) {
|
||||||
|
return configContext.GITHUB_TEST_ENV_CLIENT_ID;
|
||||||
|
}
|
||||||
|
return configContext.GITHUB_CLIENT_ID;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue