mirror of
https://github.com/bitwarden/mobile
synced 2025-12-23 11:43:49 +00:00
[KeyConnector] Add support for key connector OTP (#1633)
* initial commit - add UsesKeyConnector to UserService - add models - begin work on authentication * finish auth workflow for key connector sso login - finish api call for get user key - start api calls for posts to key connector * Bypass lock page if already unlocked * Move logic to KeyConnectorService, log out if no pin or biometric is set * Disable password reprompt when using key connector * hide password reprompt checkbox when editing or adding cipher * add PostUserKey and PostSetKeyConnector calls * add ConvertMasterPasswordPage * add functionality to RemoveMasterPasswordPage - rename Convert to Remove * Hide Change Master Password button if using key connector * Add OTP verification for export component * Update src/App/Pages/Vault/AddEditPage.xaml.cs Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * remove toolbar item "close" * Update src/Core/Models/Request/KeyConnectorUserKeyRequest.cs Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> * remove new line in resource string - format warning as two labels - set label in code behind for loading simultaneously * implement GetAndSetKey in KeyConnectorService - ignore EnvironmentService call * remove unnecesary orgIdentifier * move RemoveMasterPasswordPage call to LockPage * add spacing to export vault page * log out if no PIN or bio on lock page with key connector * Delete excessive whitespace * Delete excessive whitespace * Change capitalisation of OTP * add default value to models for backwards compatibility * remove this keyword * actually handle exceptions * move RemoveMasterPasswordPage to TabPage using messaging service * add minor improvements * remove 'this.' Co-authored-by: Hinton <oscar@oscarhinton.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
@@ -29,6 +29,8 @@ namespace Bit.Core.Models.Data
|
||||
MaxStorageGb = response.MaxStorageGb;
|
||||
Permissions = response.Permissions ?? new Permissions();
|
||||
Identifier = response.Identifier;
|
||||
UsesKeyConnector = response.UsesKeyConnector;
|
||||
KeyConnectorUrl = response.KeyConnectorUrl;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
@@ -50,5 +52,7 @@ namespace Bit.Core.Models.Data
|
||||
public short? MaxStorageGb { get; set; }
|
||||
public Permissions Permissions { get; set; } = new Permissions();
|
||||
public string Identifier { get; set; }
|
||||
public bool UsesKeyConnector { get; set; }
|
||||
public string KeyConnectorUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Bit.Core.Models.Domain
|
||||
MaxStorageGb = obj.MaxStorageGb;
|
||||
Permissions = obj.Permissions ?? new Permissions();
|
||||
Identifier = obj.Identifier;
|
||||
UsesKeyConnector = obj.UsesKeyConnector;
|
||||
KeyConnectorUrl = obj.KeyConnectorUrl;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
@@ -50,6 +52,8 @@ namespace Bit.Core.Models.Domain
|
||||
public short? MaxStorageGb { get; set; }
|
||||
public Permissions Permissions { get; set; } = new Permissions();
|
||||
public string Identifier { get; set; }
|
||||
public bool UsesKeyConnector { get; set; }
|
||||
public string KeyConnectorUrl { get; set; }
|
||||
|
||||
public bool CanAccess
|
||||
{
|
||||
|
||||
13
src/Core/Models/Request/KeyConnectorUserKeyRequest.cs
Normal file
13
src/Core/Models/Request/KeyConnectorUserKeyRequest.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
namespace Bit.Core.Models.Request
|
||||
{
|
||||
public class KeyConnectorUserKeyRequest
|
||||
{
|
||||
public string Key { get; set; }
|
||||
|
||||
public KeyConnectorUserKeyRequest(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/Core/Models/Request/SetKeyConnectorKeyRequest.cs
Normal file
24
src/Core/Models/Request/SetKeyConnectorKeyRequest.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.Models.Request
|
||||
{
|
||||
public class SetKeyConnectorKeyRequest
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public KeysRequest Keys { get; set; }
|
||||
public KdfType Kdf { get; set; }
|
||||
public int? KdfIterations { get; set; }
|
||||
public string OrgIdentifier { get; set; }
|
||||
|
||||
public SetKeyConnectorKeyRequest(string key, KeysRequest keys,
|
||||
KdfType kdf, int? kdfIterations, string orgIdentifier)
|
||||
{
|
||||
this.Key = key;
|
||||
this.Keys = keys;
|
||||
this.Kdf = kdf;
|
||||
this.KdfIterations = kdfIterations;
|
||||
this.OrgIdentifier = orgIdentifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/Core/Models/Request/VerifyOTPRequest.cs
Normal file
13
src/Core/Models/Request/VerifyOTPRequest.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
namespace Bit.Core.Models.Request
|
||||
{
|
||||
public class VerifyOTPRequest
|
||||
{
|
||||
public string OTP;
|
||||
|
||||
public VerifyOTPRequest(string otp)
|
||||
{
|
||||
OTP = otp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,5 +21,6 @@ namespace Bit.Core.Models.Response
|
||||
public KdfType Kdf { get; set; }
|
||||
public int? KdfIterations { get; set; }
|
||||
public bool ForcePasswordReset { get; set; }
|
||||
public string KeyConnectorUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
9
src/Core/Models/Response/KeyConnectorUserKeyResponse.cs
Normal file
9
src/Core/Models/Response/KeyConnectorUserKeyResponse.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Bit.Core.Models.Response
|
||||
{
|
||||
public class KeyConnectorUserKeyResponse
|
||||
{
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -25,5 +25,8 @@ namespace Bit.Core.Models.Response
|
||||
public bool Enabled { get; set; }
|
||||
public Permissions Permissions { get; set; } = new Permissions();
|
||||
public string Identifier { get; set; }
|
||||
public bool UsesKeyConnector { get; set; }
|
||||
public string KeyConnectorUrl { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,5 +18,6 @@ namespace Bit.Core.Models.Response
|
||||
public string SecurityStamp { get; set; }
|
||||
public bool ForcePasswordReset { get; set; }
|
||||
public List<ProfileOrganizationResponse> Organizations { get; set; }
|
||||
public bool UsesKeyConnector { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user