mirror of
https://github.com/standardnotes/server
synced 2026-10-17 03:03:10 -04:00
fix(auth): add relying party configuration options
This commit is contained in:
+5
-1
@@ -13,7 +13,11 @@ describe('VerifyAuthenticatorAuthenticationResponse', () => {
|
||||
let authenticatorChallengeRepository: AuthenticatorChallengeRepositoryInterface
|
||||
|
||||
const createUseCase = () =>
|
||||
new VerifyAuthenticatorAuthenticationResponse(authenticatorRepository, authenticatorChallengeRepository)
|
||||
new VerifyAuthenticatorAuthenticationResponse(
|
||||
authenticatorRepository,
|
||||
authenticatorChallengeRepository,
|
||||
'standardnotes.com',
|
||||
)
|
||||
|
||||
beforeEach(() => {
|
||||
const authenticator = Authenticator.create({
|
||||
|
||||
+3
-3
@@ -5,12 +5,12 @@ import { AuthenticatorDevice } from '@simplewebauthn/typescript-types'
|
||||
import { AuthenticatorChallengeRepositoryInterface } from '../../Authenticator/AuthenticatorChallengeRepositoryInterface'
|
||||
import { AuthenticatorRepositoryInterface } from '../../Authenticator/AuthenticatorRepositoryInterface'
|
||||
import { VerifyAuthenticatorAuthenticationResponseDTO } from './VerifyAuthenticatorAuthenticationResponseDTO'
|
||||
import { RelyingParty } from '../../Authenticator/RelyingParty'
|
||||
|
||||
export class VerifyAuthenticatorAuthenticationResponse implements UseCaseInterface<boolean> {
|
||||
constructor(
|
||||
private authenticatorRepository: AuthenticatorRepositoryInterface,
|
||||
private authenticatorChallengeRepository: AuthenticatorChallengeRepositoryInterface,
|
||||
private relyingPartyId: string,
|
||||
) {}
|
||||
|
||||
async execute(dto: VerifyAuthenticatorAuthenticationResponseDTO): Promise<Result<boolean>> {
|
||||
@@ -40,8 +40,8 @@ export class VerifyAuthenticatorAuthenticationResponse implements UseCaseInterfa
|
||||
verification = await verifyAuthenticationResponse({
|
||||
credential: dto.authenticationCredential,
|
||||
expectedChallenge: authenticatorChallenge.props.challenge.toString(),
|
||||
expectedOrigin: `https://${RelyingParty.RP_ID}`,
|
||||
expectedRPID: RelyingParty.RP_ID,
|
||||
expectedOrigin: `https://${this.relyingPartyId}`,
|
||||
expectedRPID: this.relyingPartyId,
|
||||
authenticator: {
|
||||
counter: authenticator.props.counter,
|
||||
credentialID: authenticator.props.credentialId,
|
||||
|
||||
Reference in New Issue
Block a user