Initial Move from Azure DevOps to GitHub

This commit is contained in:
Steve Faulkner
2020-05-25 21:30:55 -05:00
commit 36581fb6d9
986 changed files with 195242 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import * as ViewModels from "../Contracts/ViewModels";
import { CosmosClient } from "../Common/CosmosClient";
export class PortalTokenProvider implements ViewModels.TokenProvider {
constructor() {}
public async getAuthHeader(): Promise<Headers> {
const bearerToken = CosmosClient.authorizationToken();
let fetchHeaders = new Headers();
fetchHeaders.append("authorization", bearerToken);
return fetchHeaders;
}
}

View File

@@ -0,0 +1,20 @@
import * as ViewModels from "../Contracts/ViewModels";
import { PlatformType } from "../PlatformType";
import { PortalTokenProvider } from "./PortalTokenProvider";
export class TokenProviderFactory {
private constructor() {}
public static create(): ViewModels.TokenProvider {
const platformType = window.dataExplorerPlatform;
switch (platformType) {
case PlatformType.Portal:
case PlatformType.Hosted:
return new PortalTokenProvider();
case PlatformType.Emulator:
default:
// should never get into this state
throw new Error(`Unknown platform ${platformType}`);
}
}
}