2015-12-08 22:57:38 -05:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2016-05-19 19:10:24 -04:00
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
2017-03-08 21:45:08 -05:00
|
|
|
|
using Bit.Core.Models.Table;
|
2017-01-14 10:02:37 -05:00
|
|
|
|
using System.Security.Claims;
|
2017-06-07 14:14:34 -04:00
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
|
using Bit.Core.Models;
|
2017-06-21 22:33:45 -04:00
|
|
|
|
using Bit.Core.Models.Business;
|
2015-12-08 22:57:38 -05:00
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Services
|
|
|
|
|
|
{
|
|
|
|
|
|
public interface IUserService
|
|
|
|
|
|
{
|
2017-01-14 10:02:37 -05:00
|
|
|
|
Guid? GetProperUserId(ClaimsPrincipal principal);
|
2017-01-11 21:46:36 -05:00
|
|
|
|
Task<User> GetUserByIdAsync(string userId);
|
2016-05-21 17:16:22 -04:00
|
|
|
|
Task<User> GetUserByIdAsync(Guid userId);
|
2017-01-24 22:46:54 -05:00
|
|
|
|
Task<User> GetUserByPrincipalAsync(ClaimsPrincipal principal);
|
2017-01-14 10:02:37 -05:00
|
|
|
|
Task<DateTime> GetAccountRevisionDateByIdAsync(Guid userId);
|
2015-12-08 22:57:38 -05:00
|
|
|
|
Task SaveUserAsync(User user);
|
2016-02-20 23:25:44 -05:00
|
|
|
|
Task<IdentityResult> RegisterUserAsync(User user, string masterPassword);
|
2015-12-08 22:57:38 -05:00
|
|
|
|
Task SendMasterPasswordHintAsync(string email);
|
2017-06-20 10:08:59 -04:00
|
|
|
|
Task SendTwoFactorEmailAsync(User user);
|
|
|
|
|
|
Task<bool> VerifyTwoFactorEmailAsync(User user, string token);
|
2017-06-21 22:33:45 -04:00
|
|
|
|
Task<U2fRegistration> StartU2fRegistrationAsync(User user);
|
|
|
|
|
|
Task<bool> CompleteU2fRegistrationAsync(User user, string deviceResponse);
|
2017-07-01 23:20:19 -04:00
|
|
|
|
Task SendEmailVerificationAsync(User user);
|
|
|
|
|
|
Task<IdentityResult> ConfirmEmailAsync(User user, string token);
|
2015-12-08 22:57:38 -05:00
|
|
|
|
Task InitiateEmailChangeAsync(User user, string newEmail);
|
2017-05-31 09:54:32 -04: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);
|
|
|
|
|
|
Task<IdentityResult> UpdateKeyAsync(User user, string masterPassword, string key, string privateKey,
|
|
|
|
|
|
IEnumerable<Cipher> ciphers, IEnumerable<Folder> folders);
|
2015-12-08 22:57:38 -05:00
|
|
|
|
Task<IdentityResult> RefreshSecurityStampAsync(User user, string masterPasswordHash);
|
2017-06-07 14:14:34 -04:00
|
|
|
|
Task UpdateTwoFactorProviderAsync(User user, TwoFactorProviderType type);
|
2017-06-19 22:08:10 -04:00
|
|
|
|
Task DisableTwoFactorProviderAsync(User user, TwoFactorProviderType type);
|
2016-11-14 23:32:15 -05:00
|
|
|
|
Task<bool> RecoverTwoFactorAsync(string email, string masterPassword, string recoveryCode);
|
2017-05-31 09:54:32 -04:00
|
|
|
|
Task<string> GenerateUserTokenAsync(User user, string tokenProvider, string purpose);
|
2015-12-27 00:14:56 -05:00
|
|
|
|
Task<IdentityResult> DeleteAsync(User user);
|
2017-08-09 10:53:42 -04:00
|
|
|
|
Task<IdentityResult> DeleteAsync(User user, string token);
|
|
|
|
|
|
Task SendDeleteConfirmationAsync(string email);
|
2017-08-11 17:06:31 -04:00
|
|
|
|
Task SignUpPremiumAsync(User user, string paymentToken, short additionalStorageGb, UserLicense license);
|
2017-08-14 12:08:57 -04:00
|
|
|
|
Task UpdateLicenseAsync(User user, UserLicense license);
|
2017-07-06 14:55:58 -04: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-12 22:16:42 -04:00
|
|
|
|
Task DisablePremiumAsync(Guid userId, DateTime? expirationDate);
|
|
|
|
|
|
Task UpdatePremiumExpirationAsync(Guid userId, DateTime? expirationDate);
|
2015-12-08 22:57:38 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|