Abstraction of authenticators. Reworked Gmail authentication.

This commit is contained in:
Burak Kaan Köse
2024-11-20 01:45:48 +01:00
parent 8367efa174
commit 7fad15524f
44 changed files with 354 additions and 605 deletions

View File

@@ -1,6 +1,7 @@
using System.Threading.Tasks;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Authentication;
namespace Wino.Core.Domain.Interfaces
{
@@ -11,26 +12,28 @@ namespace Wino.Core.Domain.Interfaces
/// </summary>
MailProviderType ProviderType { get; }
/// <summary>
/// Gets the token from the cache if exists.
/// If the token is expired, tries to refresh.
/// This can throw AuthenticationAttentionException if silent refresh fails.
/// </summary>
/// <param name="account">Account to get token for.</param>
/// <returns>Valid token info to be used in integrators.</returns>
Task<TokenInformation> GetTokenAsync(MailAccount account);
Task<TokenInformationEx> GetTokenInformationAsync(MailAccount account);
/// <summary>
/// Initial creation of token. Requires user interaction.
/// This will cache the token but still returns for account creation
/// since account address is required.
/// </summary>
/// <returns>Freshly created TokenInformation..</returns>
Task<TokenInformation> GenerateTokenAsync(MailAccount account, bool saveToken);
Task<TokenInformationEx> GenerateTokenInformationAsync(MailAccount account);
/// <summary>
/// ClientId in case of needed for authorization/authentication.
/// </summary>
string ClientId { get; }
///// <summary>
///// Gets the token for the given account from the cache.
///// Forces interactive login if the token is not found.
///// </summary>
///// <param name="account">Account to get access token for.</param>
///// <returns>Access token</returns>
//Task<string> GetTokenAsync(MailAccount account);
///// <summary>
///// Forces an interactive login to get the token for the given account.
///// </summary>
///// <param name="account">Account to get access token for.</param>
///// <returns>Access token</returns>
//// Task<string> GenerateTokenAsync(MailAccount account);
///// <summary>
///// ClientId in case of needed for authorization/authentication.
///// </summary>
//string ClientId { get; }
}
}