tgstation-server 6.16.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 public OAuthProviderInfos(IOAuthProviders oAuthProviders)
28 {
29 ArgumentNullException.ThrowIfNull(oAuthProviders);
30
31 var dic = oAuthProviders.ProviderInfos();
32
33 TProviderInfo? TryBuild<TProviderInfo>(OAuthProvider oAuthProvider, Func<OAuthProviderInfo, TProviderInfo> contructor)
34 where TProviderInfo : BasicOAuthProviderInfo
35 {
36 if (dic.TryGetValue(oAuthProvider, out var providerInfo))
37 {
38 return contructor(providerInfo);
39 }
40
41 return null;
42 }
43
44 Discord = TryBuild(OAuthProvider.Discord, info => new BasicOAuthProviderInfo(info));
45 GitHub = TryBuild(OAuthProvider.GitHub, info => new RedirectOAuthProviderInfo(info));
46 }
47 }
48}
OAuthProviderInfos(IOAuthProviders oAuthProviders)
Initializes a new instance of the OAuthProviderInfos class.
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 OAuth2.0 providers supported by TGS that do not support OIDC.