mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
[SSO Auto Enroll] Auto Enroll status retrieval (#1540)
* [SSO Auto Enroll] Auto Enroll status retrieval * Updated object property to match server
This commit is contained in:
parent
14b51b1a7f
commit
024d9380c9
4 changed files with 30 additions and 6 deletions
|
@ -97,12 +97,21 @@ namespace Bit.App.Pages
|
|||
public async Task InitAsync()
|
||||
{
|
||||
await CheckPasswordPolicy();
|
||||
|
||||
var org = await _userService.GetOrganizationByIdentifierAsync(OrgIdentifier);
|
||||
OrgId = org?.Id;
|
||||
var policyList = await _policyService.GetAll(PolicyType.ResetPassword);
|
||||
var policyResult = _policyService.GetResetPasswordPolicyOptions(policyList, OrgId);
|
||||
ResetPasswordAutoEnroll = policyResult.Item2 && policyResult.Item1.AutoEnrollEnabled;
|
||||
|
||||
try
|
||||
{
|
||||
var response = await _apiService.GetOrganizationAutoEnrollStatusAsync(OrgIdentifier);
|
||||
OrgId = response.Id;
|
||||
ResetPasswordAutoEnroll = response.ResetPasswordEnrolled;
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
if (e?.Error != null)
|
||||
{
|
||||
await _platformUtilsService.ShowDialogAsync(e.Error.GetSingleMessage(),
|
||||
AppResources.AnErrorHasOccurred);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SubmitAsync()
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace Bit.Core.Abstractions
|
|||
Task PutDeviceTokenAsync(string identifier, DeviceTokenRequest request);
|
||||
Task PostEventsCollectAsync(IEnumerable<EventRequest> request);
|
||||
Task<OrganizationKeysResponse> GetOrganizationKeysAsync(string id);
|
||||
Task<OrganizationAutoEnrollStatusResponse> GetOrganizationAutoEnrollStatusAsync(string identifier);
|
||||
Task PutOrganizationUserResetPasswordEnrollmentAsync(string orgId, string userId,
|
||||
OrganizationUserResetPasswordEnrollmentRequest request);
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
namespace Bit.Core.Models.Response
|
||||
{
|
||||
public class OrganizationAutoEnrollStatusResponse
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public bool ResetPasswordEnrolled { get; set; }
|
||||
}
|
||||
}
|
|
@ -410,6 +410,12 @@ namespace Bit.Core.Services
|
|||
{
|
||||
return SendAsync<object, OrganizationKeysResponse>(HttpMethod.Get, $"/organizations/{id}/keys", null, true, true);
|
||||
}
|
||||
|
||||
public Task<OrganizationAutoEnrollStatusResponse> GetOrganizationAutoEnrollStatusAsync(string identifier)
|
||||
{
|
||||
return SendAsync<object, OrganizationAutoEnrollStatusResponse>(HttpMethod.Get,
|
||||
$"/organizations/{identifier}/auto-enroll-status", null, true, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
Loading…
Reference in a new issue