tgstation-server 6.16.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#pragma warning disable CS0618 // Type or member is obsolete
18 public override OAuthProvider Provider => OAuthProvider.InvisionCommunity;
19#pragma warning restore CS0618 // Type or member is obsolete
20
22 protected override Uri TokenUrl => new($"{OAuthConfiguration.ServerUrl}/oauth/token/"); // This needs the trailing slash or it doesnt get the token. Do not remove.
23
25 protected override Uri UserInformationUrl => new($"{OAuthConfiguration.ServerUrl}/api/core/me");
26
35 ILogger<InvisionCommunityOAuthValidator> logger,
36 OAuthConfiguration oAuthConfiguration)
37 : base(httpClientFactory, logger, oAuthConfiguration)
38 {
39 }
40
42 protected override OAuthTokenRequest CreateTokenRequest(string code) => new(OAuthConfiguration, code, "profile");
43
45 protected override string DecodeTokenPayload(dynamic responseJson) => responseJson.access_token;
46
48 protected override string DecodeUserInformationPayload(dynamic responseJson) => responseJson.id;
49 }
50}
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 OAuth2.0 providers supported by TGS that do not support OIDC.