tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
InvisionCommunityOAuthValidator.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.Extensions.Logging;
4
8
10{
15 {
17 public override OAuthProvider Provider => OAuthProvider.InvisionCommunity;
18
20 protected override Uri TokenUrl => new($"{OAuthConfiguration.ServerUrl}/oauth/token/"); // This needs the trailing slash or it doesnt get the token. Do not remove.
21
23 protected override Uri UserInformationUrl => new($"{OAuthConfiguration.ServerUrl}/api/core/me");
24
33 ILogger<InvisionCommunityOAuthValidator> logger,
34 OAuthConfiguration oAuthConfiguration)
35 : base(httpClientFactory, logger, oAuthConfiguration)
36 {
37 }
38
40 protected override OAuthTokenRequest CreateTokenRequest(string code) => new(OAuthConfiguration, code, "profile");
41
43 protected override string DecodeTokenPayload(dynamic responseJson) => responseJson.access_token;
44
46 protected override string DecodeUserInformationPayload(dynamic responseJson) => responseJson.id;
47 }
48}
OAuthConfiguration OAuthConfiguration
The OAuthConfiguration for the GenericOAuthValidator.
readonly IAbstractHttpClientFactory httpClientFactory
The IHttpClientFactory for the GenericOAuthValidator.
override OAuthTokenRequest CreateTokenRequest(string code)
InvisionCommunityOAuthValidator(IAbstractHttpClientFactory httpClientFactory, ILogger< InvisionCommunityOAuthValidator > logger, OAuthConfiguration oAuthConfiguration)
Initializes a new instance of the InvisionCommunityOAuthValidator class.
override OAuthProvider Provider
The OAuthProvider this validator is for.
override string DecodeUserInformationPayload(dynamic responseJson)
OAuthProvider
List of OAuth providers supported by TGS.