Remove AdHoc Access and Token Renewal Pane (#445)

This commit is contained in:
Steve Faulkner
2021-02-23 11:16:00 -06:00
committed by GitHub
parent 3777b6922e
commit f0c82a430b
12 changed files with 8 additions and 654 deletions

View File

@@ -58,48 +58,4 @@ describe("AuthorizationUtils", () => {
).toBeDefined();
});
});
describe("displayTokenRenewalPromptForStatus()", () => {
let explorer = new Explorer() as jest.Mocked<Explorer>;
beforeEach(() => {
jest.clearAllMocks();
window.dataExplorer = explorer;
updateConfigContext({
platform: Platform.Hosted,
});
});
afterEach(() => {
window.dataExplorer = undefined;
});
it("should not open token renewal prompt if status code is undefined", () => {
AuthorizationUtils.displayTokenRenewalPromptForStatus(undefined);
expect(explorer.displayGuestAccessTokenRenewalPrompt).not.toHaveBeenCalled();
});
it("should not open token renewal prompt if status code is null", () => {
AuthorizationUtils.displayTokenRenewalPromptForStatus(null);
expect(explorer.displayGuestAccessTokenRenewalPrompt).not.toHaveBeenCalled();
});
it("should not open token renewal prompt if status code is not 401", () => {
AuthorizationUtils.displayTokenRenewalPromptForStatus(Constants.HttpStatusCodes.Forbidden);
expect(explorer.displayGuestAccessTokenRenewalPrompt).not.toHaveBeenCalled();
});
it("should not open token renewal prompt if running on a different platform", () => {
updateConfigContext({
platform: Platform.Portal,
});
AuthorizationUtils.displayTokenRenewalPromptForStatus(Constants.HttpStatusCodes.Unauthorized);
expect(explorer.displayGuestAccessTokenRenewalPrompt).not.toHaveBeenCalled();
});
it("should open token renewal prompt if running on hosted platform and status code is 401", () => {
AuthorizationUtils.displayTokenRenewalPromptForStatus(Constants.HttpStatusCodes.Unauthorized);
expect(explorer.displayGuestAccessTokenRenewalPrompt).toHaveBeenCalled();
});
});
});

View File

@@ -40,17 +40,3 @@ export function decryptJWTToken(token: string) {
return JSON.parse(tokenPayload);
}
export function displayTokenRenewalPromptForStatus(httpStatusCode: number): void {
const explorer = window.dataExplorer;
if (
httpStatusCode == null ||
httpStatusCode != Constants.HttpStatusCodes.Unauthorized ||
configContext.platform !== Platform.Hosted
) {
return;
}
explorer.displayGuestAccessTokenRenewalPrompt();
}