tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
OAuthProviderInfos.cs
Go to the documentation of this file.
1using System;
2
5
7{
11 public sealed class OAuthProviderInfos
12 {
17
22
27
32
37
42 public OAuthProviderInfos(IOAuthProviders oAuthProviders)
43 {
44 ArgumentNullException.ThrowIfNull(oAuthProviders);
45
46 var dic = oAuthProviders.ProviderInfos();
47
48 TProviderInfo? TryBuild<TProviderInfo>(OAuthProvider oAuthProvider, Func<OAuthProviderInfo, TProviderInfo> contructor)
49 where TProviderInfo : BasicOAuthProviderInfo
50 {
51 if (dic.TryGetValue(oAuthProvider, out var providerInfo))
52 {
53 return contructor(providerInfo);
54 }
55
56 return null;
57 }
58
59 Discord = TryBuild(OAuthProvider.Discord, info => new BasicOAuthProviderInfo(info));
60 GitHub = TryBuild(OAuthProvider.GitHub, info => new RedirectOAuthProviderInfo(info));
61 TGForums = TryBuild(OAuthProvider.TGForums, info => new RedirectOAuthProviderInfo(info));
62 Keycloak = TryBuild(OAuthProvider.Keycloak, info => new FullOAuthProviderInfo(info));
63 InvisionCommunity = TryBuild(OAuthProvider.InvisionCommunity, info => new FullOAuthProviderInfo(info));
64 }
65 }
66}
OAuth provider info with a RedirectOAuthProviderInfo.RedirectUri and ServerUrl.
OAuthProviderInfos(IOAuthProviders oAuthProviders)
Initializes a new instance of the OAuthProviderInfos class.
RedirectOAuthProviderInfo? TGForums
https://tgstation13.org.
FullOAuthProviderInfo? Keycloak
https://www.keycloak.org.
FullOAuthProviderInfo? InvisionCommunity
https://invisioncommunity.com.
BasicOAuthProviderInfo? Discord
https://discord.com.
RedirectOAuthProviderInfo? GitHub
https://github.com.
Dictionary< OAuthProvider, OAuthProviderInfo > ProviderInfos()
Gets a Dictionary<TKey, TValue> of the provider client IDs.
OAuthProvider
List of OAuth providers supported by TGS.