1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-21 18:53:29 +00:00

[SG-174] Login with Device Request - Mobile (#2167)

* [SG-174] Add new login request services to Api

* [SG-174] Fix typo

* [SG-174] Enable login with device button.

* [SG-174] Add new login request page and viewmodel

* [SG-174] Add new text resources

* [SG-174] Add new RSA Decrypt method with string param

* [SG-174] Change create login request method

* [SG-174] Add new method to auth service to login passwordless

* [SG-174] Refactor login helper method to work with passwordless

* [SG-174] Fix service registration

* [SG-174] Update token request to support passwordless

* [SG-174] Update Api service with passwordless methods

* [SG-174] Fix App csproj references

* [SG-174] Remove unnecessary argument

* [SG-174] dotnet format

* [SG-174] Fixed iOS Extensions

* [SG-174] Change Command to ICommand

* [SG-174] Change Gesture Recognizer to Command

* [SG-174] Fix close action

* [SG-174] Code format

* [SG-174] Fix android frame shadow bug

* [SG-174] PR fixes
This commit is contained in:
André Bispo
2022-11-09 16:25:48 +00:00
committed by GitHub
parent 04ed47d545
commit 9ae269dd57
25 changed files with 618 additions and 15 deletions

View File

@@ -0,0 +1,34 @@
using System;
namespace Bit.Core.Models.Request
{
public class PasswordlessCreateLoginRequest
{
public PasswordlessCreateLoginRequest(string email, string publicKey, string deviceIdentifier, string accessCode, AuthRequestType? type, string fingerprintPhrase)
{
Email = email ?? throw new ArgumentNullException(nameof(email));
PublicKey = publicKey ?? throw new ArgumentNullException(nameof(publicKey));
DeviceIdentifier = deviceIdentifier ?? throw new ArgumentNullException(nameof(deviceIdentifier));
AccessCode = accessCode ?? throw new ArgumentNullException(nameof(accessCode));
Type = type;
FingerprintPhrase = fingerprintPhrase ?? throw new ArgumentNullException(nameof(fingerprintPhrase));
}
public string Email { get; set; }
public string PublicKey { get; set; }
public string DeviceIdentifier { get; set; }
public string AccessCode { get; set; }
public AuthRequestType? Type { get; set; }
public string FingerprintPhrase { get; set; }
}
public enum AuthRequestType : byte
{
AuthenticateAndUnlock = 0,
Unlock = 1
}
}

View File

@@ -15,13 +15,14 @@ namespace Bit.Core.Models.Request
public string CodeVerifier { get; set; }
public string RedirectUri { get; set; }
public string Token { get; set; }
public string AuthRequestId { get; set; }
public TwoFactorProviderType? Provider { get; set; }
public bool? Remember { get; set; }
public string CaptchaToken { get; set; }
public DeviceRequest Device { get; set; }
public TokenRequest(string[] credentials, string[] codes, TwoFactorProviderType? provider, string token,
bool? remember, string captchaToken, DeviceRequest device = null)
bool? remember, string captchaToken, DeviceRequest device = null, string authRequestId = null)
{
if (credentials != null && credentials.Length > 1)
{
@@ -39,6 +40,7 @@ namespace Bit.Core.Models.Request
Remember = remember;
Device = device;
CaptchaToken = captchaToken;
AuthRequestId = authRequestId;
}
public Dictionary<string, string> ToIdentityToken(string clientId)
@@ -67,6 +69,11 @@ namespace Bit.Core.Models.Request
throw new Exception("must provide credentials or codes");
}
if (AuthRequestId != null)
{
obj.Add("authRequest", AuthRequestId);
}
if (Device != null)
{
obj.Add("deviceType", ((int)Device.Type).ToString());

View File

@@ -15,5 +15,7 @@ namespace Bit.Core.Models.Response
public DateTime CreationDate { get; set; }
public bool RequestApproved { get; set; }
public string Origin { get; set; }
public string RequestAccessCode { get; set; }
public Tuple<byte[], byte[]> RequestKeyPair { get; set; }
}
}