Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Configuration.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4
5namespace Stroika::Frameworks::Auth::OAuth {
6
7 /*
8 ********************************************************************************
9 ************************ Auth::OAuth::ProviderConfiguration ********************
10 ********************************************************************************
11 */
12 inline const ObjectVariantMapper ProviderConfiguration::kMapper = [] () {
13 ObjectVariantMapper mapper;
14 mapper.AddCommonType<URI> ();
15 mapper.AddCommonType<optional<URI>> ();
16 mapper.AddClass<ProviderConfiguration> ({
17 {"provider"sv, &ProviderConfiguration::name},
18 {"openid_configuration_uri"sv, &ProviderConfiguration::openid_configuration_uri},
19 {"auth_uri"sv, &ProviderConfiguration::auth_uri},
20 {"token_uri"sv, &ProviderConfiguration::token_uri},
21 {"userinfo_endpoint"sv, &ProviderConfiguration::userinfo_endpoint},
22 {"revocation_endpoint"sv, &ProviderConfiguration::revocation_endpoint},
23 {"auth_provider_x509_cert_url"sv, &ProviderConfiguration::auth_provider_x509_cert_url},
24 });
25 return mapper;
26 }();
27
28 /*
29 ********************************************************************************
30 ************************ Auth::OAuth::ClientConfiguration **********************
31 ********************************************************************************
32 */
33 inline const ObjectVariantMapper ClientConfiguration::kMapper = [] () {
34 ObjectVariantMapper mapper;
35 mapper.AddCommonType<optional<String>> ();
36 mapper.AddCommonType<RedirectURLType> ();
37 mapper.AddCommonType<Sequence<RedirectURLType>> ();
38 mapper.AddCommonType<Set<String>> ();
39 mapper.AddClass<ClientConfiguration> ({
40 {"provider"sv, &ClientConfiguration::fProvider},
41 {"applicationID"sv, &ClientConfiguration::fApplicationID},
42 {"redirectURLs"sv, &ClientConfiguration::fRedirectURLs},
43 {"scopes"sv, &ClientConfiguration::fScopes},
44 {"clientSecret"sv, &ClientConfiguration::fClientSecret},
45 });
46 return mapper;
47 }();
48
49 /*
50 ********************************************************************************
51 ****************** Auth::OAuth::kDefaultProviderConfigurations *****************
52 ********************************************************************************
53 */
55 ProviderConfiguration{.name = "google"sv,
56 .openid_configuration_uri = "https://accounts.google.com/"sv,
57 .auth_uri = "https://accounts.google.com/o/oauth2/auth"sv,
58 .token_uri = "https://oauth2.googleapis.com/token"sv,
59 .userinfo_endpoint = "https://openidconnect.googleapis.com/v1/userinfo"sv,
60 .revocation_endpoint = "https://oauth2.googleapis.com/revoke"sv,
61 .auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs"sv},
62 ProviderConfiguration{.name = "microsoft"sv,
63 .openid_configuration_uri = "https://login.microsoftonline.com/common/v2.0/"sv,
64 .auth_uri = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"sv,
65 .token_uri = "https://login.microsoftonline.com/common/oauth2/v2.0/token"sv,
66 .userinfo_endpoint = "https://graph.microsoft.com/oidc/userinfo"sv,
67 .auth_provider_x509_cert_url = "https://login.microsoftonline.com/common/discovery/v2.0/keys"sv},
68 ProviderConfiguration{.name = "apple"sv,
69 .openid_configuration_uri = "https://account.apple.com/"sv,
70 .auth_uri = "https://appleid.apple.com/auth/authorize"sv,
71 .token_uri = "https://appleid.apple.com/auth/token"sv,
72 .auth_provider_x509_cert_url = "https://appleid.apple.com/auth/keys"sv},
73 ProviderConfiguration{.name = "facebook"sv,
74 .openid_configuration_uri = "https://www.facebook.com/"sv,
75 .auth_uri = "https://facebook.com/dialog/oauth/"sv,
76 .auth_provider_x509_cert_url = "https://www.facebook.com/.well-known/oauth/openid/jwks/"sv},
77 ProviderConfiguration{.name = "twitter"sv, .auth_uri = "https://api.twitter.com/oauth/authorize"sv, .token_uri = "https://api.twitter.com/oauth/request_token"sv},
78 };
79
80}
const ProvidersConfigurations kDefaultProviderConfigurations
a cross between Mapping<KEY, T> and Collection<T> and Set<T>
Track configuration data about stuff that differentiates different OAuth providers - what URLs to use...