mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
* run FormatCode build task to fix whitespace/formatting * correctly flag some GitHub Enterprise tests * Add Release Notes * tweak appveyor to not build branch in the repo, when a PR exists already * travis to only build master branch and PRs * output actual "dotnet run" command being executed for cake.frosting builds * update latest Cake.Frosting * use normal verbosity at the moment due to apparent conflict with "verbose" and latest SDK on appveyor * try using double dash so dotnet executable doesnt look at --verbosity argument * travis OSX couldn't download SDK 2.0.3 anymore, lets try the latest 2.1.300
24 lines
871 B
C#
24 lines
871 B
C#
using System;
|
|
using System.Globalization;
|
|
|
|
namespace Octokit.Internal
|
|
{
|
|
class BearerTokenAuthenticator : IAuthenticationHandler
|
|
{
|
|
public void Authenticate(IRequest request, Credentials credentials)
|
|
{
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
Ensure.ArgumentNotNull(credentials, nameof(credentials));
|
|
Ensure.ArgumentNotNull(credentials.Password, nameof(credentials.Password));
|
|
|
|
if (credentials.Login != null)
|
|
{
|
|
throw new InvalidOperationException("The Login is not null for a token authentication request. You " +
|
|
"probably did something wrong.");
|
|
}
|
|
|
|
request.Headers["Authorization"] = string.Format(CultureInfo.InvariantCulture, "Bearer {0}", credentials.Password);
|
|
}
|
|
}
|
|
}
|