mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 06:56:27 +00:00
26 lines
550 B
C#
26 lines
550 B
C#
using System.Threading.Tasks;
|
|
|
|
namespace SpotifyAPI.Web.Http
|
|
{
|
|
public class TokenHeaderAuthenticator : IAuthenticator
|
|
{
|
|
public TokenHeaderAuthenticator(string token, string tokenType)
|
|
{
|
|
Token = token;
|
|
TokenType = tokenType;
|
|
}
|
|
|
|
public string Token { get; set; }
|
|
|
|
public string TokenType { get; set; }
|
|
|
|
public Task Apply(IRequest request)
|
|
{
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
request.Headers["Authorization"] = $"{TokenType} {Token}";
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
}
|