22
Wino.Core/Authenticators/Base/BaseAuthenticator.cs
Normal file
22
Wino.Core/Authenticators/Base/BaseAuthenticator.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Entities.Shared;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Services;
|
||||
|
||||
namespace Wino.Core.Authenticators.Base
|
||||
{
|
||||
public abstract class BaseAuthenticator
|
||||
{
|
||||
public abstract MailProviderType ProviderType { get; }
|
||||
|
||||
protected ITokenService TokenService { get; }
|
||||
|
||||
protected BaseAuthenticator(ITokenService tokenService)
|
||||
{
|
||||
TokenService = tokenService;
|
||||
}
|
||||
|
||||
internal Task SaveTokenInternalAsync(MailAccount account, TokenInformation tokenInformation)
|
||||
=> TokenService.SaveTokenInformationAsync(account.Id, tokenInformation);
|
||||
}
|
||||
}
|
||||
21
Wino.Core/Authenticators/Base/GmailAuthenticatorBase.cs
Normal file
21
Wino.Core/Authenticators/Base/GmailAuthenticatorBase.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Entities.Shared;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Services;
|
||||
|
||||
namespace Wino.Core.Authenticators.Base
|
||||
{
|
||||
public abstract class GmailAuthenticatorBase : BaseAuthenticator, IGmailAuthenticator
|
||||
{
|
||||
protected GmailAuthenticatorBase(ITokenService tokenService) : base(tokenService)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract string ClientId { get; }
|
||||
public bool ProposeCopyAuthURL { get; set; }
|
||||
|
||||
public abstract Task<TokenInformation> GenerateTokenAsync(MailAccount account, bool saveToken);
|
||||
|
||||
public abstract Task<TokenInformation> GetTokenAsync(MailAccount account);
|
||||
}
|
||||
}
|
||||
20
Wino.Core/Authenticators/Base/OutlookAuthenticatorBase.cs
Normal file
20
Wino.Core/Authenticators/Base/OutlookAuthenticatorBase.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Entities.Shared;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Services;
|
||||
|
||||
namespace Wino.Core.Authenticators.Base
|
||||
{
|
||||
public abstract class OutlookAuthenticatorBase : BaseAuthenticator, IOutlookAuthenticator
|
||||
{
|
||||
protected OutlookAuthenticatorBase(ITokenService tokenService) : base(tokenService)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract string ClientId { get; }
|
||||
|
||||
public abstract Task<TokenInformation> GenerateTokenAsync(MailAccount account, bool saveToken);
|
||||
|
||||
public abstract Task<TokenInformation> GetTokenAsync(MailAccount account);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user