2019-04-18 15:45:31 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
using Bit.Core.Models.Domain;
|
2022-11-09 17:25:48 +01:00
|
|
|
|
using Bit.Core.Models.Request;
|
2022-09-26 19:27:57 +02:00
|
|
|
|
using Bit.Core.Models.Response;
|
2019-04-18 15:45:31 +02:00
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Abstractions
|
|
|
|
|
{
|
|
|
|
|
public interface IAuthService
|
|
|
|
|
{
|
|
|
|
|
string Email { get; set; }
|
|
|
|
|
string MasterPasswordHash { get; set; }
|
2020-09-03 18:30:40 +02:00
|
|
|
|
string Code { get; set; }
|
|
|
|
|
string CodeVerifier { get; set; }
|
|
|
|
|
string SsoRedirectUrl { get; set; }
|
2019-04-18 15:45:31 +02:00
|
|
|
|
TwoFactorProviderType? SelectedTwoFactorProviderType { get; set; }
|
2019-05-27 16:28:38 +02:00
|
|
|
|
Dictionary<TwoFactorProviderType, TwoFactorProvider> TwoFactorProviders { get; set; }
|
|
|
|
|
Dictionary<TwoFactorProviderType, Dictionary<string, object>> TwoFactorProvidersData { get; set; }
|
2019-04-18 15:45:31 +02:00
|
|
|
|
|
2021-08-30 18:44:12 +02:00
|
|
|
|
TwoFactorProviderType? GetDefaultTwoFactorProvider(bool fido2Supported);
|
2020-09-03 18:30:40 +02:00
|
|
|
|
bool AuthingWithSso();
|
|
|
|
|
bool AuthingWithPassword();
|
2019-04-18 15:45:31 +02:00
|
|
|
|
List<TwoFactorProvider> GetSupportedTwoFactorProviders();
|
2021-08-04 21:47:23 +02:00
|
|
|
|
Task<AuthResult> LogInAsync(string email, string masterPassword, string captchaToken);
|
2021-11-16 15:34:26 +01:00
|
|
|
|
Task<AuthResult> LogInSsoAsync(string code, string codeVerifier, string redirectUrl, string orgId);
|
2019-04-18 15:45:31 +02:00
|
|
|
|
Task<AuthResult> LogInCompleteAsync(string email, string masterPassword, TwoFactorProviderType twoFactorProvider, string twoFactorToken, bool? remember = null);
|
2022-03-07 19:39:38 +01:00
|
|
|
|
Task<AuthResult> LogInTwoFactorAsync(TwoFactorProviderType twoFactorProvider, string twoFactorToken, string captchaToken, bool? remember = null);
|
2022-11-09 17:25:48 +01:00
|
|
|
|
Task<AuthResult> LogInPasswordlessAsync(string email, string accessCode, string authRequestId, byte[] decryptionKey, string userKeyCiphered, string localHashedPasswordCiphered);
|
2022-09-26 19:27:57 +02:00
|
|
|
|
|
2022-11-15 18:36:21 +01:00
|
|
|
|
Task<List<PasswordlessLoginResponse>> GetPasswordlessLoginRequestsAsync();
|
2022-09-26 19:27:57 +02:00
|
|
|
|
Task<PasswordlessLoginResponse> GetPasswordlessLoginRequestByIdAsync(string id);
|
2022-11-09 17:25:48 +01:00
|
|
|
|
Task<PasswordlessLoginResponse> GetPasswordlessLoginResponseAsync(string id, string accessCode);
|
2022-09-26 19:27:57 +02:00
|
|
|
|
Task<PasswordlessLoginResponse> PasswordlessLoginAsync(string id, string pubKey, bool requestApproved);
|
2022-11-09 17:25:48 +01:00
|
|
|
|
Task<PasswordlessLoginResponse> PasswordlessCreateLoginRequestAsync(string email);
|
2022-09-26 19:27:57 +02:00
|
|
|
|
|
2019-04-18 15:45:31 +02:00
|
|
|
|
void LogOut(Action callback);
|
2019-04-18 18:31:35 +02:00
|
|
|
|
void Init();
|
2019-04-18 15:45:31 +02:00
|
|
|
|
}
|
2020-09-03 18:30:40 +02:00
|
|
|
|
}
|