Add AAD endpoints for all environments

This commit is contained in:
Senthamil Sindhu
2024-08-21 10:08:55 -07:00
parent 4176a8a9a9
commit ec3afa0526
4 changed files with 38 additions and 2 deletions

View File

@@ -183,6 +183,12 @@ export class CassandraProxyAPIs {
public static readonly connectionStringSchemaApi: string = "api/connectionstring/cassandra/schema"; public static readonly connectionStringSchemaApi: string = "api/connectionstring/cassandra/schema";
} }
export class AadEndpoints {
public static readonly Prod: string = "https://login.microsoftonline.com/";
public static readonly Fairfax: string = "https://login.microsoftonline.us/";
public static readonly Mooncake: string = "https://login.partner.microsoftonline.cn/";
}
export class Queries { export class Queries {
public static CustomPageOption: string = "custom"; public static CustomPageOption: string = "custom";
public static UnlimitedPageOption: string = "unlimited"; public static UnlimitedPageOption: string = "unlimited";

View File

@@ -5,6 +5,7 @@ import {
MongoProxyEndpoints, MongoProxyEndpoints,
PortalBackendEndpoints, PortalBackendEndpoints,
} from "Common/Constants"; } from "Common/Constants";
import { userContext } from "UserContext";
import { import {
allowedAadEndpoints, allowedAadEndpoints,
allowedArcadiaEndpoints, allowedArcadiaEndpoints,
@@ -36,6 +37,7 @@ export interface ConfigContext {
gitSha?: string; gitSha?: string;
proxyPath?: string; proxyPath?: string;
AAD_ENDPOINT: string; AAD_ENDPOINT: string;
ENVIRONMENT: string;
ARM_AUTH_AREA: string; ARM_AUTH_AREA: string;
ARM_ENDPOINT: string; ARM_ENDPOINT: string;
EMULATOR_ENDPOINT?: string; EMULATOR_ENDPOINT?: string;
@@ -91,7 +93,7 @@ let configContext: Readonly<ConfigContext> = {
], // Webpack injects this at build time ], // Webpack injects this at build time
gitSha: process.env.GIT_SHA, gitSha: process.env.GIT_SHA,
hostedExplorerURL: "https://cosmos.azure.com/", hostedExplorerURL: "https://cosmos.azure.com/",
AAD_ENDPOINT: "https://login.microsoftonline.com/", AAD_ENDPOINT: "",
ARM_AUTH_AREA: "https://management.azure.com/", ARM_AUTH_AREA: "https://management.azure.com/",
ARM_ENDPOINT: "https://management.azure.com/", ARM_ENDPOINT: "https://management.azure.com/",
ARM_API_VERSION: "2016-06-01", ARM_API_VERSION: "2016-06-01",

View File

@@ -52,7 +52,10 @@ export const defaultAllowedArmEndpoints: ReadonlyArray<string> = [
"https://management.chinacloudapi.cn", "https://management.chinacloudapi.cn",
]; ];
export const allowedAadEndpoints: ReadonlyArray<string> = ["https://login.microsoftonline.com/"]; export const allowedAadEndpoints: ReadonlyArray<string> = ["https://login.microsoftonline.com/",
"https://login.microsoftonline.us/",
"https://login.partner.microsoftonline.cn/"
];
export const defaultAllowedBackendEndpoints: ReadonlyArray<string> = [ export const defaultAllowedBackendEndpoints: ReadonlyArray<string> = [
"https://main.documentdb.ext.azure.com", "https://main.documentdb.ext.azure.com",

View File

@@ -639,6 +639,31 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
PORTAL_BACKEND_ENDPOINT: inputs.portalBackendEndpoint, PORTAL_BACKEND_ENDPOINT: inputs.portalBackendEndpoint,
}); });
const portalEnv = inputs.serverId as PortalEnv;
switch (portalEnv) {
case "prod1":
case "prod":
updateConfigContext({
AAD_ENDPOINT: Constants.AadEndpoints.Prod
});
break;
case "fairfax":
updateConfigContext({
AAD_ENDPOINT: Constants.AadEndpoints.Fairfax
});
break;
case "mooncake":
updateConfigContext({
AAD_ENDPOINT: Constants.AadEndpoints.Mooncake
});
break;
default:
console.warn(`Unknown portal environment: ${portalEnv}`);
break;
}
updateUserContext({ updateUserContext({
authorizationToken, authorizationToken,
databaseAccount, databaseAccount,