1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-04 14:13:28 +01:00
bitwarden-server/src/Core/Services/IUserService.cs

56 lines
3.1 KiB
C#
Raw Normal View History

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;
using System.Security.Claims;
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
{
Guid? GetProperUserId(ClaimsPrincipal principal);
Task<User> GetUserByIdAsync(string userId);
Task<User> GetUserByIdAsync(Guid userId);
Task<User> GetUserByPrincipalAsync(ClaimsPrincipal principal);
Task<DateTime> GetAccountRevisionDateByIdAsync(Guid userId);
2017-08-14 19:06:44 +02:00
Task SaveUserAsync(User user, bool push = false);
Task<IdentityResult> RegisterUserAsync(User user, string masterPassword);
2015-12-09 04:57:38 +01:00
Task SendMasterPasswordHintAsync(string email);
Task SendTwoFactorEmailAsync(User user);
Task<bool> VerifyTwoFactorEmailAsync(User user, string token);
2017-06-22 04:33:45 +02:00
Task<U2fRegistration> StartU2fRegistrationAsync(User user);
Task<bool> CompleteU2fRegistrationAsync(User user, 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);
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);
Task UpdateTwoFactorProviderAsync(User user, TwoFactorProviderType type);
Task DisableTwoFactorProviderAsync(User user, TwoFactorProviderType type);
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);
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);
Task DisablePremiumAsync(User user, DateTime? expirationDate);
2017-08-13 04:16:42 +02:00
Task UpdatePremiumExpirationAsync(Guid userId, DateTime? expirationDate);
Task<UserLicense> GenerateLicenseAsync(User user, BillingInfo billingInfo = null);
2018-04-17 14:10:17 +02:00
Task<bool> CheckPasswordAsync(User user, string password);
2015-12-09 04:57:38 +01:00
}
}