From 20e3963847f7c3b42141b87d1580e905696c5586 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 3 Jan 2019 00:13:46 -0500 Subject: [PATCH] check duo keys on org config as well --- src/Api/Controllers/TwoFactorController.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Api/Controllers/TwoFactorController.cs b/src/Api/Controllers/TwoFactorController.cs index 2690d0c55d..e8122cff4d 100644 --- a/src/Api/Controllers/TwoFactorController.cs +++ b/src/Api/Controllers/TwoFactorController.cs @@ -201,6 +201,16 @@ namespace Bit.Api.Controllers throw new NotFoundException(); } + try + { + var duoApi = new DuoApi(model.IntegrationKey, model.SecretKey, model.Host); + duoApi.JSONApiCall("GET", "/auth/v2/check"); + } + catch(DuoException) + { + throw new BadRequestException("Duo configuration settings are not valid. Please re-check the Duo Admin panel."); + } + model.ToOrganization(organization); await _organizationService.UpdateTwoFactorProviderAsync(organization, TwoFactorProviderType.OrganizationDuo);