Cleaning up the solution. Separating Shared.WinRT, Services and Synchronization. Removing synchronization from app. Reducing bundle size by 45mb.
This commit is contained in:
33
Wino.Synchronization/Http/MicrosoftTokenProvider.cs
Normal file
33
Wino.Synchronization/Http/MicrosoftTokenProvider.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Kiota.Abstractions.Authentication;
|
||||
using Wino.Domain.Entities;
|
||||
using Wino.Domain.Interfaces;
|
||||
|
||||
namespace Wino.Core.Http
|
||||
{
|
||||
public class MicrosoftTokenProvider : IAccessTokenProvider
|
||||
{
|
||||
private readonly MailAccount _account;
|
||||
private readonly IAuthenticator _authenticator;
|
||||
|
||||
public MicrosoftTokenProvider(MailAccount account, IAuthenticator authenticator)
|
||||
{
|
||||
_account = account;
|
||||
_authenticator = authenticator;
|
||||
}
|
||||
|
||||
public AllowedHostsValidator AllowedHostsValidator { get; }
|
||||
|
||||
public async Task<string> GetAuthorizationTokenAsync(Uri uri,
|
||||
Dictionary<string, object> additionalAuthenticationContext = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var token = await _authenticator.GetTokenAsync(_account).ConfigureAwait(false);
|
||||
|
||||
return token?.AccessToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user