tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
KeycloakOAuthValidator.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.Keycloak;
18
20 protected override Uri TokenUrl => new($"{BaseProtocolPath}/token");
21
23 protected override Uri UserInformationUrl => new($"{BaseProtocolPath}/userinfo");
24
28 string BaseProtocolPath => $"{OAuthConfiguration.ServerUrl}/protocol/openid-connect";
29
38 ILogger<KeycloakOAuthValidator> logger,
39 OAuthConfiguration oAuthConfiguration)
40 : base(httpClientFactory, logger, oAuthConfiguration)
41 {
42 }
43
45 protected override OAuthTokenRequest CreateTokenRequest(string code) => new(OAuthConfiguration, code, "openid");
46
48 protected override string DecodeTokenPayload(dynamic responseJson) => responseJson.access_token;
49
51 protected override string DecodeUserInformationPayload(dynamic responseJson) => responseJson.sub;
52 }
53}
OAuthConfiguration OAuthConfiguration
The OAuthConfiguration for the GenericOAuthValidator.
readonly IAbstractHttpClientFactory httpClientFactory
The IHttpClientFactory for the GenericOAuthValidator.
override string DecodeUserInformationPayload(dynamic responseJson)
override string DecodeTokenPayload(dynamic responseJson)
KeycloakOAuthValidator(IAbstractHttpClientFactory httpClientFactory, ILogger< KeycloakOAuthValidator > logger, OAuthConfiguration oAuthConfiguration)
Initializes a new instance of the KeycloakOAuthValidator class.
override OAuthTokenRequest CreateTokenRequest(string code)
string BaseProtocolPath
Base path to the server's OAuth endpoint.
override OAuthProvider Provider
The OAuthProvider this validator is for.
OAuthProvider
List of OAuth providers supported by TGS.