Stroika Library 3.0d23
 
Loading...
Searching...
No Matches
Configuration.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. 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 {"introspection_endpoint"sv, &ProviderConfiguration::introspection_endpoint},
25 {"tokeninfo_endpoint"sv, &ProviderConfiguration::tokeninfo_endpoint},
26 });
27 return mapper;
28 }();
29
30 /*
31 ********************************************************************************
32 ************************ Auth::OAuth::ClientConfiguration **********************
33 ********************************************************************************
34 */
35 inline const ObjectVariantMapper ClientConfiguration::kMapper = [] () {
36 ObjectVariantMapper mapper;
37 mapper.AddCommonType<optional<String>> ();
38 mapper.AddCommonType<RedirectURLType> ();
39 mapper.AddCommonType<Sequence<RedirectURLType>> ();
40 mapper.AddCommonType<Set<String>> ();
41 mapper.AddClass<ClientConfiguration> ({
42 {"provider"sv, &ClientConfiguration::fProvider},
43 {"applicationID"sv, &ClientConfiguration::fApplicationID},
44 {"redirectURLs"sv, &ClientConfiguration::fRedirectURLs},
45 {"scopes"sv, &ClientConfiguration::fScopes},
46 {"clientSecret"sv, &ClientConfiguration::fClientSecret},
47 });
48 return mapper;
49 }();
50
51 /*
52 ********************************************************************************
53 ****************** Auth::OAuth::kDefaultProviderConfigurations *****************
54 ********************************************************************************
55 */
57 ProviderConfiguration{.name = "google"sv,
58 .openid_configuration_uri = "https://accounts.google.com/"sv,
59 .auth_uri = "https://accounts.google.com/o/oauth2/auth"sv,
60 .token_uri = "https://oauth2.googleapis.com/token"sv,
61 .userinfo_endpoint = "https://openidconnect.googleapis.com/v1/userinfo"sv,
62 .revocation_endpoint = "https://oauth2.googleapis.com/revoke"sv,
63 .auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs"sv,
64 .tokeninfo_endpoint = "https://oauth2.googleapis.com/tokeninfo"sv},
65 ProviderConfiguration{.name = "microsoft"sv,
66 .openid_configuration_uri = "https://login.microsoftonline.com/common/v2.0/"sv,
67 .auth_uri = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"sv,
68 .token_uri = "https://login.microsoftonline.com/common/oauth2/v2.0/token"sv,
69 .userinfo_endpoint = "https://graph.microsoft.com/oidc/userinfo"sv,
70 .auth_provider_x509_cert_url = "https://login.microsoftonline.com/common/discovery/v2.0/keys"sv},
71 ProviderConfiguration{.name = "apple"sv,
72 .openid_configuration_uri = "https://account.apple.com/"sv,
73 .auth_uri = "https://appleid.apple.com/auth/authorize"sv,
74 .token_uri = "https://appleid.apple.com/auth/token"sv,
75 .auth_provider_x509_cert_url = "https://appleid.apple.com/auth/keys"sv},
76 ProviderConfiguration{.name = "facebook"sv,
77 .openid_configuration_uri = "https://www.facebook.com/"sv,
78 .auth_uri = "https://facebook.com/dialog/oauth/"sv,
79 .auth_provider_x509_cert_url = "https://www.facebook.com/.well-known/oauth/openid/jwks/"sv},
80 ProviderConfiguration{.name = "twitter"sv, .auth_uri = "https://api.twitter.com/oauth/authorize"sv, .token_uri = "https://api.twitter.com/oauth/request_token"sv},
81 };
82
83}
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...
optional< URI > tokeninfo_endpoint
logically similar to introspection_endpoint, but googles incompatible way
optional< URI > introspection_endpoint
RFC 7662 compatible API for finding info about a token - https://datatracker.ietf....