mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
Remove window.authType (#437)
This commit is contained in:
@@ -9,8 +9,8 @@ jest.mock("../Explorer/Explorer");
|
||||
describe("AuthorizationUtils", () => {
|
||||
describe("getAuthorizationHeader()", () => {
|
||||
it("should return authorization header if authentication type is AAD", () => {
|
||||
window.authType = AuthType.AAD;
|
||||
updateUserContext({
|
||||
authType: AuthType.AAD,
|
||||
authorizationToken: "some-token",
|
||||
});
|
||||
|
||||
@@ -19,8 +19,8 @@ describe("AuthorizationUtils", () => {
|
||||
});
|
||||
|
||||
it("should return guest access header if authentication type is EncryptedToken", () => {
|
||||
window.authType = AuthType.EncryptedToken;
|
||||
updateUserContext({
|
||||
authType: AuthType.EncryptedToken,
|
||||
accessToken: "some-token",
|
||||
});
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as ViewModels from "../Contracts/ViewModels";
|
||||
import { userContext } from "../UserContext";
|
||||
|
||||
export function getAuthorizationHeader(): ViewModels.AuthorizationTokenHeaderMetadata {
|
||||
if (window.authType === AuthType.EncryptedToken) {
|
||||
if (userContext.authType === AuthType.EncryptedToken) {
|
||||
return {
|
||||
header: Constants.HttpHeaders.guestAccessToken,
|
||||
token: userContext.accessToken,
|
||||
|
||||
@@ -10,8 +10,8 @@ interface Global {
|
||||
((global as unknown) as Global).Headers = ((fetch as unknown) as Global).Headers;
|
||||
|
||||
describe("ARM request", () => {
|
||||
window.authType = AuthType.AAD;
|
||||
updateUserContext({
|
||||
authType: AuthType.AAD,
|
||||
authorizationToken: "some-token",
|
||||
});
|
||||
|
||||
@@ -57,8 +57,8 @@ describe("ARM request", () => {
|
||||
});
|
||||
|
||||
it("should throw token error", async () => {
|
||||
window.authType = AuthType.AAD;
|
||||
updateUserContext({
|
||||
authType: AuthType.AAD,
|
||||
authorizationToken: undefined,
|
||||
});
|
||||
const headers = new Headers();
|
||||
|
||||
Reference in New Issue
Block a user