Removed automatic fallback to browser when no credentials exist (#7135)
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
This commit is contained in:
parent
00bb814fbe
commit
c289b3b8a4
|
@ -9,7 +9,6 @@ import {
|
||||||
Fido2AuthenticatorGetAssertionParams,
|
Fido2AuthenticatorGetAssertionParams,
|
||||||
Fido2AuthenticatorMakeCredentialsParams,
|
Fido2AuthenticatorMakeCredentialsParams,
|
||||||
} from "../../abstractions/fido2/fido2-authenticator.service.abstraction";
|
} from "../../abstractions/fido2/fido2-authenticator.service.abstraction";
|
||||||
import { FallbackRequestedError } from "../../abstractions/fido2/fido2-client.service.abstraction";
|
|
||||||
import {
|
import {
|
||||||
Fido2UserInterfaceService,
|
Fido2UserInterfaceService,
|
||||||
Fido2UserInterfaceSession,
|
Fido2UserInterfaceSession,
|
||||||
|
@ -484,17 +483,6 @@ describe("FidoAuthenticatorService", () => {
|
||||||
expect(userInterfaceSession.informCredentialNotFound).toHaveBeenCalled();
|
expect(userInterfaceSession.informCredentialNotFound).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should automatically fallback if no credential exists when fallback is supported", async () => {
|
|
||||||
params.fallbackSupported = true;
|
|
||||||
cipherService.getAllDecrypted.mockResolvedValue([]);
|
|
||||||
userInterfaceSession.informCredentialNotFound.mockResolvedValue();
|
|
||||||
|
|
||||||
const result = async () => await authenticator.getAssertion(params, tab);
|
|
||||||
|
|
||||||
await expect(result).rejects.toThrowError(FallbackRequestedError);
|
|
||||||
expect(userInterfaceSession.informCredentialNotFound).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should inform user if credential exists but rpId does not match", async () => {
|
it("should inform user if credential exists but rpId does not match", async () => {
|
||||||
const cipher = await createCipherView({ type: CipherType.Login });
|
const cipher = await createCipherView({ type: CipherType.Login });
|
||||||
cipher.login.fido2Credentials[0].credentialId = credentialId;
|
cipher.login.fido2Credentials[0].credentialId = credentialId;
|
||||||
|
|
|
@ -12,7 +12,6 @@ import {
|
||||||
Fido2AuthenticatorService as Fido2AuthenticatorServiceAbstraction,
|
Fido2AuthenticatorService as Fido2AuthenticatorServiceAbstraction,
|
||||||
PublicKeyCredentialDescriptor,
|
PublicKeyCredentialDescriptor,
|
||||||
} from "../../abstractions/fido2/fido2-authenticator.service.abstraction";
|
} from "../../abstractions/fido2/fido2-authenticator.service.abstraction";
|
||||||
import { FallbackRequestedError } from "../../abstractions/fido2/fido2-client.service.abstraction";
|
|
||||||
import { Fido2UserInterfaceService } from "../../abstractions/fido2/fido2-user-interface.service.abstraction";
|
import { Fido2UserInterfaceService } from "../../abstractions/fido2/fido2-user-interface.service.abstraction";
|
||||||
import { SyncService } from "../../abstractions/sync/sync.service.abstraction";
|
import { SyncService } from "../../abstractions/sync/sync.service.abstraction";
|
||||||
import { CipherRepromptType } from "../../enums/cipher-reprompt-type";
|
import { CipherRepromptType } from "../../enums/cipher-reprompt-type";
|
||||||
|
@ -225,10 +224,6 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
||||||
`[Fido2Authenticator] Aborting because no matching credentials were found in the vault.`,
|
`[Fido2Authenticator] Aborting because no matching credentials were found in the vault.`,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (params.fallbackSupported) {
|
|
||||||
throw new FallbackRequestedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
await userInterfaceSession.informCredentialNotFound();
|
await userInterfaceSession.informCredentialNotFound();
|
||||||
throw new Fido2AuthenticatorError(Fido2AuthenticatorErrorCode.NotAllowed);
|
throw new Fido2AuthenticatorError(Fido2AuthenticatorErrorCode.NotAllowed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,11 +272,6 @@ export class Fido2ClientService implements Fido2ClientServiceAbstraction {
|
||||||
abortController,
|
abortController,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof FallbackRequestedError) {
|
|
||||||
this.logService?.info(`[Fido2Client] Aborting because of auto fallback`);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
abortController.signal.aborted &&
|
abortController.signal.aborted &&
|
||||||
abortController.signal.reason === UserRequestedFallbackAbortReason
|
abortController.signal.reason === UserRequestedFallbackAbortReason
|
||||||
|
|
Loading…
Reference in New Issue