csharp.libraries.generichost.BearerToken.mustache Maven / Gradle / Ivy
The newest version!
//
{{partial_header}}
{{#nrt}}
#nullable enable
{{/nrt}}
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace {{packageName}}.{{clientPackage}}
{
///
/// A token constructed from a token from a bearer token.
///
{{>visibility}} class BearerToken : TokenBase
{
private string _raw;
///
/// Constructs a BearerToken object.
///
///
///
public BearerToken(string value, TimeSpan? timeout = null) : base(timeout)
{
_raw = value;
}
///
/// Places the token in the header.
///
///
///
public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName)
{
request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy