tgstation-server
6.12.3
The /tg/station 13 server suite
Loading...
Searching...
No Matches
src
Tgstation.Server.Client.GraphQL
AuthorizationMessageHandler.cs
Go to the documentation of this file.
1
using
System.Net.Http;
2
using
System.Net.Http.Headers;
3
using
System.Threading;
4
using
System.Threading.Tasks;
5
6
namespace
Tgstation.Server.Client.GraphQL
7
{
11
sealed
class
AuthorizationMessageHandler
:
DelegatingHandler
12
{
16
public
static
AsyncLocal<AuthenticationHeaderValue?>
Header
{
get
; } =
new
AsyncLocal<AuthenticationHeaderValue?>();
17
21
readonly AuthenticationHeaderValue?
headerOverride
;
22
27
public
AuthorizationMessageHandler
(AuthenticationHeaderValue?
headerOverride
)
28
{
29
this.headerOverride =
headerOverride
;
30
}
31
33
protected
override
Task<HttpResponseMessage>
SendAsync
(HttpRequestMessage request, CancellationToken cancellationToken)
34
{
35
var currentAuthHeader =
headerOverride
??
Header
.Value;
36
if
(currentAuthHeader !=
null
)
37
request.Headers.Authorization = currentAuthHeader;
38
39
return
base.SendAsync(request, cancellationToken);
40
}
41
}
42
}
DelegatingHandler
Tgstation.Server.Client.GraphQL.AuthorizationMessageHandler
DelegatingHandler that applies the AuthenticationHeaderValue.
Definition
AuthorizationMessageHandler.cs:12
Tgstation.Server.Client.GraphQL.AuthorizationMessageHandler.SendAsync
override Task< HttpResponseMessage > SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Definition
AuthorizationMessageHandler.cs:33
Tgstation.Server.Client.GraphQL.AuthorizationMessageHandler.Header
static AsyncLocal< AuthenticationHeaderValue?> Header
The AsyncLocal<T> AuthenticationHeaderValue to be applied.
Definition
AuthorizationMessageHandler.cs:16
Tgstation.Server.Client.GraphQL.AuthorizationMessageHandler.AuthorizationMessageHandler
AuthorizationMessageHandler(AuthenticationHeaderValue? headerOverride)
Initializes a new instance of the AuthorizationMessageHandler class.
Definition
AuthorizationMessageHandler.cs:27
Tgstation.Server.Client.GraphQL.AuthorizationMessageHandler.headerOverride
readonly? AuthenticationHeaderValue headerOverride
class override for Header.
Definition
AuthorizationMessageHandler.cs:21
Tgstation.Server.Client.GraphQL
Definition
AuthenticatedGraphQLServerClient.cs:12
Generated by
1.9.8