|
|
|
|
@ -10,6 +10,8 @@ using Bit.Core.AdminConsole.Enums;
@@ -10,6 +10,8 @@ using Bit.Core.AdminConsole.Enums;
|
|
|
|
|
using Bit.Core.AdminConsole.Models.Data.Organizations.Policies; |
|
|
|
|
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.Interfaces; |
|
|
|
|
using Bit.Core.AdminConsole.Repositories; |
|
|
|
|
using Bit.Core.Auth.Enums; |
|
|
|
|
using Bit.Core.Auth.Repositories; |
|
|
|
|
using Bit.Core.Context; |
|
|
|
|
using Bit.Core.Enums; |
|
|
|
|
using Bit.Core.Exceptions; |
|
|
|
|
@ -46,6 +48,7 @@ public class OrganizationUsersController : Controller
@@ -46,6 +48,7 @@ public class OrganizationUsersController : Controller
|
|
|
|
|
private readonly IAuthorizationService _authorizationService; |
|
|
|
|
private readonly IApplicationCacheService _applicationCacheService; |
|
|
|
|
private readonly IFeatureService _featureService; |
|
|
|
|
private readonly ISsoConfigRepository _ssoConfigRepository; |
|
|
|
|
|
|
|
|
|
public OrganizationUsersController( |
|
|
|
|
IOrganizationRepository organizationRepository, |
|
|
|
|
@ -63,7 +66,8 @@ public class OrganizationUsersController : Controller
@@ -63,7 +66,8 @@ public class OrganizationUsersController : Controller
|
|
|
|
|
IAcceptOrgUserCommand acceptOrgUserCommand, |
|
|
|
|
IAuthorizationService authorizationService, |
|
|
|
|
IApplicationCacheService applicationCacheService, |
|
|
|
|
IFeatureService featureService) |
|
|
|
|
IFeatureService featureService, |
|
|
|
|
ISsoConfigRepository ssoConfigRepository) |
|
|
|
|
{ |
|
|
|
|
_organizationRepository = organizationRepository; |
|
|
|
|
_organizationUserRepository = organizationUserRepository; |
|
|
|
|
@ -81,6 +85,7 @@ public class OrganizationUsersController : Controller
@@ -81,6 +85,7 @@ public class OrganizationUsersController : Controller
|
|
|
|
|
_authorizationService = authorizationService; |
|
|
|
|
_applicationCacheService = applicationCacheService; |
|
|
|
|
_featureService = featureService; |
|
|
|
|
_ssoConfigRepository = ssoConfigRepository; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpGet("{id}")] |
|
|
|
|
@ -456,7 +461,9 @@ public class OrganizationUsersController : Controller
@@ -456,7 +461,9 @@ public class OrganizationUsersController : Controller
|
|
|
|
|
throw new UnauthorizedAccessException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(model.ResetPasswordKey) && !await _userService.VerifySecretAsync(user, model.Secret)) |
|
|
|
|
var ssoConfig = await _ssoConfigRepository.GetByOrganizationIdAsync(orgId); |
|
|
|
|
var isTdeEnrollment = ssoConfig != null && ssoConfig.GetData().MemberDecryptionType == MemberDecryptionType.TrustedDeviceEncryption; |
|
|
|
|
if (!isTdeEnrollment && !string.IsNullOrWhiteSpace(model.ResetPasswordKey) && !await _userService.VerifySecretAsync(user, model.MasterPasswordHash)) |
|
|
|
|
{ |
|
|
|
|
throw new BadRequestException("Incorrect password"); |
|
|
|
|
} |
|
|
|
|
|