2015-12-09 04:57:38 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
2016-05-20 01:10:24 +02:00
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
2017-03-09 03:45:08 +01:00
|
|
|
|
using Bit.Core.Models.Table;
|
2017-01-14 16:02:37 +01:00
|
|
|
|
using System.Security.Claims;
|
2017-06-07 20:14:34 +02:00
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
using Bit.Core.Models;
|
2017-06-22 04:33:45 +02:00
|
|
|
|
using Bit.Core.Models.Business;
|
2015-12-09 04:57:38 +01:00
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Services
|
|
|
|
|
{
|
|
|
|
|
public interface IUserService
|
|
|
|
|
{
|
2017-01-14 16:02:37 +01:00
|
|
|
|
Guid? GetProperUserId(ClaimsPrincipal principal);
|
2017-01-12 03:46:36 +01:00
|
|
|
|
Task<User> GetUserByIdAsync(string userId);
|
2016-05-21 23:16:22 +02:00
|
|
|
|
Task<User> GetUserByIdAsync(Guid userId);
|
2017-01-25 04:46:54 +01:00
|
|
|
|
Task<User> GetUserByPrincipalAsync(ClaimsPrincipal principal);
|
2017-01-14 16:02:37 +01:00
|
|
|
|
Task<DateTime> GetAccountRevisionDateByIdAsync(Guid userId);
|
2017-08-14 19:06:44 +02:00
|
|
|
|
Task SaveUserAsync(User user, bool push = false);
|
2018-05-24 22:53:07 +02:00
|
|
|
|
Task<IdentityResult> RegisterUserAsync(User user, string masterPassword, string token, Guid? orgUserId);
|
2015-12-09 04:57:38 +01:00
|
|
|
|
Task SendMasterPasswordHintAsync(string email);
|
2017-06-20 16:08:59 +02:00
|
|
|
|
Task SendTwoFactorEmailAsync(User user);
|
|
|
|
|
Task<bool> VerifyTwoFactorEmailAsync(User user, string token);
|
2017-06-22 04:33:45 +02:00
|
|
|
|
Task<U2fRegistration> StartU2fRegistrationAsync(User user);
|
2018-10-08 20:38:11 +02:00
|
|
|
|
Task<bool> DeleteU2fKeyAsync(User user, int id);
|
|
|
|
|
Task<bool> CompleteU2fRegistrationAsync(User user, int id, string name, string deviceResponse);
|
2017-07-02 05:20:19 +02:00
|
|
|
|
Task SendEmailVerificationAsync(User user);
|
|
|
|
|
Task<IdentityResult> ConfirmEmailAsync(User user, string token);
|
2015-12-09 04:57:38 +01:00
|
|
|
|
Task InitiateEmailChangeAsync(User user, string newEmail);
|
2017-05-31 15:54:32 +02:00
|
|
|
|
Task<IdentityResult> ChangeEmailAsync(User user, string masterPassword, string newEmail, string newMasterPassword,
|
|
|
|
|
string token, string key);
|
|
|
|
|
Task<IdentityResult> ChangePasswordAsync(User user, string masterPassword, string newMasterPassword, string key);
|
2018-08-14 21:30:04 +02:00
|
|
|
|
Task<IdentityResult> ChangeKdfAsync(User user, string masterPassword, string newMasterPassword, string key,
|
|
|
|
|
KdfType kdf, int kdfIterations);
|
2017-05-31 15:54:32 +02:00
|
|
|
|
Task<IdentityResult> UpdateKeyAsync(User user, string masterPassword, string key, string privateKey,
|
|
|
|
|
IEnumerable<Cipher> ciphers, IEnumerable<Folder> folders);
|
2015-12-09 04:57:38 +01:00
|
|
|
|
Task<IdentityResult> RefreshSecurityStampAsync(User user, string masterPasswordHash);
|
2017-06-07 20:14:34 +02:00
|
|
|
|
Task UpdateTwoFactorProviderAsync(User user, TwoFactorProviderType type);
|
2017-06-20 04:08:10 +02:00
|
|
|
|
Task DisableTwoFactorProviderAsync(User user, TwoFactorProviderType type);
|
2016-11-15 05:32:15 +01:00
|
|
|
|
Task<bool> RecoverTwoFactorAsync(string email, string masterPassword, string recoveryCode);
|
2017-05-31 15:54:32 +02:00
|
|
|
|
Task<string> GenerateUserTokenAsync(User user, string tokenProvider, string purpose);
|
2015-12-27 06:14:56 +01:00
|
|
|
|
Task<IdentityResult> DeleteAsync(User user);
|
2017-08-09 16:53:42 +02:00
|
|
|
|
Task<IdentityResult> DeleteAsync(User user, string token);
|
|
|
|
|
Task SendDeleteConfirmationAsync(string email);
|
2017-08-11 23:06:31 +02:00
|
|
|
|
Task SignUpPremiumAsync(User user, string paymentToken, short additionalStorageGb, UserLicense license);
|
2017-08-14 18:08:57 +02:00
|
|
|
|
Task UpdateLicenseAsync(User user, UserLicense license);
|
2017-07-06 20:55:58 +02:00
|
|
|
|
Task AdjustStorageAsync(User user, short storageAdjustmentGb);
|
|
|
|
|
Task ReplacePaymentMethodAsync(User user, string paymentToken);
|
|
|
|
|
Task CancelPremiumAsync(User user, bool endOfPeriod = false);
|
|
|
|
|
Task ReinstatePremiumAsync(User user);
|
2017-08-13 04:16:42 +02:00
|
|
|
|
Task DisablePremiumAsync(Guid userId, DateTime? expirationDate);
|
2017-08-16 23:08:20 +02:00
|
|
|
|
Task DisablePremiumAsync(User user, DateTime? expirationDate);
|
2017-08-13 04:16:42 +02:00
|
|
|
|
Task UpdatePremiumExpirationAsync(Guid userId, DateTime? expirationDate);
|
2017-08-30 17:23:55 +02:00
|
|
|
|
Task<UserLicense> GenerateLicenseAsync(User user, BillingInfo billingInfo = null);
|
2018-04-17 14:10:17 +02:00
|
|
|
|
Task<bool> CheckPasswordAsync(User user, string password);
|
2018-08-28 22:23:58 +02:00
|
|
|
|
Task<bool> CanAccessPremium(User user);
|
2018-12-19 16:47:53 +01:00
|
|
|
|
Task<bool> TwoFactorIsEnabledAsync(User user);
|
|
|
|
|
Task<bool> TwoFactorProviderIsEnabledAsync(TwoFactorProviderType provider, User user);
|
2015-12-09 04:57:38 +01:00
|
|
|
|
}
|
|
|
|
|
}
|