mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-10-15 05:52:55 +00:00
WIP sign in failed
This commit is contained in:
@@ -440,6 +440,26 @@ describe('AuthProvider', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('failed sign-in', () => {
|
||||||
|
it('keeps an existing session', async () => {
|
||||||
|
await givenLoadedToken(makeToken({accessToken: 'still-valid'}));
|
||||||
|
|
||||||
|
internals.notify({action: AuthActions.SignInFailed, error: new Error('state mismatch')});
|
||||||
|
|
||||||
|
expect(await isLoggedIn()).toBeTrue();
|
||||||
|
expect(internals.tokenSubject.value?.accessToken).toBe('still-valid');
|
||||||
|
expect(storageRemoveItem).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('stays logged out without a session', async () => {
|
||||||
|
await givenLoadedToken(null);
|
||||||
|
|
||||||
|
internals.notify({action: AuthActions.SignInFailed, error: new Error('access_denied')});
|
||||||
|
|
||||||
|
expect(await isLoggedIn()).toBeFalse();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('signOut', () => {
|
describe('signOut', () => {
|
||||||
/** The [token, token_type_hint, client_id] of each revoke request, in order. */
|
/** The [token, token_type_hint, client_id] of each revoke request, in order. */
|
||||||
const revokedTokens = () =>
|
const revokedTokens = () =>
|
||||||
|
|||||||
@@ -1304,7 +1304,6 @@ export class AuthProvider {
|
|||||||
action: IAuthAction,
|
action: IAuthAction,
|
||||||
): void {
|
): void {
|
||||||
switch (action.action) {
|
switch (action.action) {
|
||||||
case AuthActions.SignInFailed:
|
|
||||||
case AuthActions.SignOutSuccess:
|
case AuthActions.SignOutSuccess:
|
||||||
case AuthActions.SignOutFailed:
|
case AuthActions.SignOutFailed:
|
||||||
case AuthActions.SessionExpired: {
|
case AuthActions.SessionExpired: {
|
||||||
|
|||||||
Reference in New Issue
Block a user