Fixed the SPA authentication flow
This commit is contained in:
@@ -4,13 +4,25 @@ function createBackgroundApplication(overrides = {}) {
|
||||
browser: globalThis.browser,
|
||||
chrome: globalThis.chrome,
|
||||
setTimeout: globalThis.setTimeout,
|
||||
clearTimeout: globalThis.clearTimeout,
|
||||
...overrides
|
||||
};
|
||||
const messageTypes = createMessageTypes();
|
||||
const timeEntries = createTimeEntries({ dates: createTimeDates(), fetchJson: (...args) => httpBackgroundJson.fetchJson(...args), getResourceUser: message => fusionSrCreate.getResourceUser(message), saveHeaders: url => srRequestHeaders.timeEntriesHeaders(url) });
|
||||
const spaCurrentUser = createSpaCurrentUser({ fetchJson: (...args) => httpBackgroundJson.fetchJson(...args) });
|
||||
const requestCurrentUser = () => spaCurrentUser.requestCurrentUser();
|
||||
const contracts = createBackgroundContracts();
|
||||
const spaPageClient = createSpaPageClient({
|
||||
sendMessage: (...args) => platformBackgroundApi.tabsSendMessage(...args),
|
||||
getHttp: () => httpBackgroundJson
|
||||
});
|
||||
const spaCurrentUser = createSpaCurrentUser({
|
||||
fetchJson: (...args) => httpBackgroundJson.fetchJson(...args),
|
||||
fetchInTab: (tab, logs) => spaPageClient.requestIdentity(tab, logs),
|
||||
openSessionTab: sender => authConsumerSession.openConsumerTokenSessionTab(sender),
|
||||
waitForSession: (tab, entry) => authConsumerSession.waitForSpaPage(tab, entry),
|
||||
closeSessionTab: id => authConsumerSession.closeConsumerTokenSessionTab(id),
|
||||
sessionUrl: contracts.CUSTOMER_TOKEN_SESSION_URL
|
||||
});
|
||||
const requestCurrentUser = sender => spaCurrentUser.requestCurrentUser(sender);
|
||||
const productsCacheState = createProductsCacheState();
|
||||
const authConsumerSession = createAuthConsumerSession({
|
||||
CUSTOMER_TOKEN_MAX_ATTEMPTS: contracts.CUSTOMER_TOKEN_MAX_ATTEMPTS,
|
||||
@@ -22,7 +34,13 @@ function createBackgroundApplication(overrides = {}) {
|
||||
fetchJson: (...args) => httpBackgroundJson.fetchJson(...args),
|
||||
supportsFirefoxCookieStoreTabs: (...args) => platformBackgroundApi.supportsFirefoxCookieStoreTabs(...args),
|
||||
tabsCreate: (...args) => platformBackgroundApi.tabsCreate(...args),
|
||||
tabsUpdate: (...args) => platformBackgroundApi.tabsUpdate(...args),
|
||||
tabsRemove: (...args) => platformBackgroundApi.tabsRemove(...args),
|
||||
responseHeaders: (environment.browser || environment.chrome)?.webRequest?.onHeadersReceived,
|
||||
cookieChanges: (environment.browser || environment.chrome)?.cookies?.onChanged,
|
||||
inspectPage: tab => spaPageClient.inspect(tab),
|
||||
setTimeout: environment.setTimeout,
|
||||
clearTimeout: environment.clearTimeout,
|
||||
wait: (...args) => platformBackgroundApi.wait(...args)
|
||||
});
|
||||
const authSpaCredentials = createAuthSpaCredentials({
|
||||
|
||||
Reference in New Issue
Block a user