minor optimization to reuse the HttpClient and added helper function
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace OpenHarbor.JwtTokenManager.Abstractions;
|
||||
|
||||
public static class HttpClientExtensions
|
||||
{
|
||||
public static HttpClient SetJwtAccessToken(this HttpClient httpClient, JwtTokenManagerResult token)
|
||||
{
|
||||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(token.TokenType.ToString(), token.AccessToken);
|
||||
return httpClient;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,10 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<Authors>Mathias Beaulieu-Duncan</Authors>
|
||||
<PackageIconUrl>https://gravatar.com/avatar/9cecda5822fc5d4d2e61ec03da571b3d?size=256</PackageIconUrl>
|
||||
<RepositoryUrl>https://git.openharbor.io/Open-Harbor/dotnet-jwt-token-manager</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user