Use compute auth service and fix static code analyzer warnings (#15)

* Clean up formatting

* Use new compute_auth service
Implment SSO
Implement token refresh
Clean up unit tests

* Fix unit tests

* Fix auth test
Fix warnings

* Update default settings for compute_auth
This commit is contained in:
John Wu
2021-03-04 14:30:56 -08:00
committed by GitHub
parent e1f0006d5e
commit 39e779dc1d
34 changed files with 703 additions and 1462 deletions

View File

@@ -5,11 +5,7 @@ let progress = 0;
let status = null;
export const FileUploadProvider = ({ children }) => {
return (
<div data-testid="mocked-fileuploadprovider">
{children}
</div>
);
return <div data-testid="mocked-fileuploadprovider">{children}</div>;
};
export const useFileUploadContext = () => ({

View File

@@ -1,30 +1,27 @@
import React from 'react';
import React from "react";
let token = null;
let fetching = false;
let error = null;
let signInResp = {};
let signUpResp = {};
let authorizeURL = "https://cognito.com/authorize?redirect=https://example.com/callback";
let logoutURL = "https://cognito.com/logout?redirect=https://example.com/callback";
export const UserProvider = ({ children }) => {
return (
<div data-testid="mocked-userprovider">
{children}
</div>
);
return <div data-testid="mocked-userprovider">{children}</div>;
};
export const useUserContext = () => ({
token,
fetching,
error,
signIn: jest.fn(() => signInResp),
signOut: jest.fn(),
getAuthorizeURL: jest.fn(() => authorizeURL),
getLogoutURL: jest.fn(() => logoutURL),
setError: jest.fn((value) => {
error = value;
}),
signIn: jest.fn(() => signInResp),
signUp: jest.fn(() => signUpResp),
signOut: jest.fn(),
signUpAndIn: jest.fn(),
});
export const setToken = (val) => {
@@ -38,7 +35,3 @@ export const setFetching = (val) => {
export const setError = (val) => {
error = val;
};
export const setSignUpResp = (val) => {
signUpResp = val;
};