mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-08 03:57:31 +00:00
Add AAD endpoints
This commit is contained in:
@@ -5,7 +5,6 @@ import {
|
|||||||
MongoProxyEndpoints,
|
MongoProxyEndpoints,
|
||||||
PortalBackendEndpoints,
|
PortalBackendEndpoints,
|
||||||
} from "Common/Constants";
|
} from "Common/Constants";
|
||||||
import { userContext } from "UserContext";
|
|
||||||
import {
|
import {
|
||||||
allowedAadEndpoints,
|
allowedAadEndpoints,
|
||||||
allowedArcadiaEndpoints,
|
allowedArcadiaEndpoints,
|
||||||
@@ -37,7 +36,6 @@ 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;
|
||||||
@@ -93,7 +91,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: "",
|
AAD_ENDPOINT: "https://login.microsoftonline.com/",
|
||||||
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",
|
||||||
@@ -258,3 +256,4 @@ export async function initializeConfiguration(): Promise<ConfigContext> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export { configContext };
|
export { configContext };
|
||||||
|
|
||||||
|
|||||||
@@ -619,28 +619,7 @@ function shouldForwardMessage(message: PortalMessage, messageOrigin: string) {
|
|||||||
return messageOrigin === window.document.location.origin && message.type === MessageTypes.TelemetryInfo;
|
return messageOrigin === window.document.location.origin && message.type === MessageTypes.TelemetryInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
function updateAADEndpoints(portalEnv: PortalEnv) {
|
||||||
if (
|
|
||||||
configContext.BACKEND_ENDPOINT &&
|
|
||||||
configContext.platform === Platform.Portal &&
|
|
||||||
process.env.NODE_ENV === "development"
|
|
||||||
) {
|
|
||||||
inputs.extensionEndpoint = configContext.PROXY_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
const authorizationToken = inputs.authorizationToken || "";
|
|
||||||
const databaseAccount = inputs.databaseAccount;
|
|
||||||
|
|
||||||
updateConfigContext({
|
|
||||||
BACKEND_ENDPOINT: inputs.extensionEndpoint || configContext.BACKEND_ENDPOINT,
|
|
||||||
ARM_ENDPOINT: normalizeArmEndpoint(inputs.csmEndpoint || configContext.ARM_ENDPOINT),
|
|
||||||
MONGO_PROXY_ENDPOINT: inputs.mongoProxyEndpoint,
|
|
||||||
CASSANDRA_PROXY_ENDPOINT: inputs.cassandraProxyEndpoint,
|
|
||||||
PORTAL_BACKEND_ENDPOINT: inputs.portalBackendEndpoint,
|
|
||||||
});
|
|
||||||
|
|
||||||
const portalEnv = inputs.serverId as PortalEnv;
|
|
||||||
|
|
||||||
switch (portalEnv) {
|
switch (portalEnv) {
|
||||||
case "prod1":
|
case "prod1":
|
||||||
case "prod":
|
case "prod":
|
||||||
@@ -663,6 +642,29 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
|||||||
console.warn(`Unknown portal environment: ${portalEnv}`);
|
console.warn(`Unknown portal environment: ${portalEnv}`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
||||||
|
if (
|
||||||
|
configContext.BACKEND_ENDPOINT &&
|
||||||
|
configContext.platform === Platform.Portal &&
|
||||||
|
process.env.NODE_ENV === "development"
|
||||||
|
) {
|
||||||
|
inputs.extensionEndpoint = configContext.PROXY_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
const authorizationToken = inputs.authorizationToken || "";
|
||||||
|
const databaseAccount = inputs.databaseAccount;
|
||||||
|
|
||||||
|
updateConfigContext({
|
||||||
|
BACKEND_ENDPOINT: inputs.extensionEndpoint || configContext.BACKEND_ENDPOINT,
|
||||||
|
ARM_ENDPOINT: normalizeArmEndpoint(inputs.csmEndpoint || configContext.ARM_ENDPOINT),
|
||||||
|
MONGO_PROXY_ENDPOINT: inputs.mongoProxyEndpoint,
|
||||||
|
CASSANDRA_PROXY_ENDPOINT: inputs.cassandraProxyEndpoint,
|
||||||
|
PORTAL_BACKEND_ENDPOINT: inputs.portalBackendEndpoint,
|
||||||
|
});
|
||||||
|
|
||||||
|
updateAADEndpoints(inputs.serverId as PortalEnv);
|
||||||
|
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
authorizationToken,
|
authorizationToken,
|
||||||
|
|||||||
Reference in New Issue
Block a user