private async Task <IAuthenticationResponse> EnrollFactorAsync(EnrollFactorRequest request, CancellationToken cancellationToken = default) { return(await PostAsync <AuthenticationResponse>( new HttpRequest { Uri = "/api/v1/authn/factors", Payload = request, }, cancellationToken).ConfigureAwait(false)); }
/// <inheritdoc/> public async Task <IAuthenticationResponse> EnrollFactorAsync(EnrollWebAuthnFactorOptions factorOptions, CancellationToken cancellationToken = default) { var enrollTotpFactor = new EnrollFactorRequest() { StateToken = factorOptions.StateToken, FactorType = FactorType.WebAuthn, Provider = factorOptions.Provider, }; return(await EnrollFactorAsync(enrollTotpFactor, cancellationToken)); }
/// <inheritdoc/> public async Task <IAuthenticationResponse> EnrollFactorAsync(EnrollYubiKeyFactorOptions factorOptions, CancellationToken cancellationToken = default) { var enrollYubiKeyFactor = new EnrollFactorRequest() { StateToken = factorOptions.StateToken, FactorType = FactorType.TokenHardware, Provider = factorOptions.Provider, PassCode = factorOptions.PassCode, }; return(await EnrollFactorAsync(enrollYubiKeyFactor, cancellationToken)); }
/// <inheritdoc/> public async Task <IAuthenticationResponse> EnrollFactorAsync(EnrollRsaFactorOptions factorOptions, CancellationToken cancellationToken = default) { var profile = new Resource(); profile.SetProperty("credentialId", factorOptions.CredentialId); var enrollRsaFactor = new EnrollFactorRequest() { StateToken = factorOptions.StateToken, FactorType = FactorType.Token, Provider = factorOptions.Provider, PassCode = factorOptions.PassCode, Profile = profile, }; return(await EnrollFactorAsync(enrollRsaFactor, cancellationToken)); }
/// <inheritdoc/> public async Task <IAuthenticationResponse> EnrollFactorAsync(EnrollCallFactorOptions factorOptions, CancellationToken cancellationToken = default) { var profile = new Resource(); profile.SetProperty("phoneNumber", factorOptions.PhoneNumber); profile.SetProperty("phoneExtension", factorOptions.PhoneExtension); var enrollCallFactor = new EnrollFactorRequest() { StateToken = factorOptions.StateToken, FactorType = FactorType.Call, Provider = factorOptions.Provider, Profile = profile, }; return(await EnrollFactorAsync(enrollCallFactor, cancellationToken)); }
/// <inheritdoc/> public async Task <IAuthenticationResponse> EnrollFactorAsync(EnrollSecurityQuestionFactorOptions factorOptions, CancellationToken cancellationToken = default) { var profile = new Resource(); profile.SetProperty("question", factorOptions.Question); profile.SetProperty("questionText", factorOptions.QuestionText); profile.SetProperty("answer", factorOptions.Answer); var enrollQuestionFactor = new EnrollFactorRequest() { StateToken = factorOptions.StateToken, FactorType = FactorType.Question, Provider = factorOptions.Provider, Profile = profile, }; return(await EnrollFactorAsync(enrollQuestionFactor, cancellationToken)); }
/// <inheritdoc/> public async Task <IAuthenticationResponse> ResendCallEnrollFactorAsync(EnrollCallFactorOptions factorOptions, CancellationToken cancellationToken = default) { var profile = new Resource(); profile.SetProperty("phoneNumber", factorOptions.PhoneNumber); profile.SetProperty("phoneExtension", factorOptions.PhoneExtension); var enrollCallFactor = new EnrollFactorRequest() { StateToken = factorOptions.StateToken, FactorType = FactorType.Call, Provider = factorOptions.Provider, Profile = profile, }; return(await PostAsync <AuthenticationResponse>( new HttpRequest { Uri = $"/api/v1/authn/factors/{factorOptions.FactorId}/lifecycle/resend", Payload = enrollCallFactor, }, cancellationToken).ConfigureAwait(false)); }