Beispiel #1
0
 internal IdentityProviders(AzureActiveDirectory azureActiveDirectory, FacebookProvider facebook, GitHubProvider gitHub, GoogleProvider google, TwitterProvider twitter, AppleProvider apple, AzureStaticWebApps azureStaticWebApps, IDictionary <string, CustomOpenIdConnectProvider> customOpenIdConnectProviders)
 {
     AzureActiveDirectory = azureActiveDirectory;
     Facebook             = facebook;
     GitHub                       = gitHub;
     Google                       = google;
     Twitter                      = twitter;
     Apple                        = apple;
     AzureStaticWebApps           = azureStaticWebApps;
     CustomOpenIdConnectProviders = customOpenIdConnectProviders;
 }
Beispiel #2
0
        internal static IdentityProviders DeserializeIdentityProviders(JsonElement element)
        {
            Optional <AzureActiveDirectory> azureActiveDirectory = default;
            Optional <FacebookProvider>     facebook             = default;
            Optional <GitHubProvider>       gitHub             = default;
            Optional <GoogleProvider>       google             = default;
            Optional <TwitterProvider>      twitter            = default;
            Optional <AppleProvider>        apple              = default;
            Optional <AzureStaticWebApps>   azureStaticWebApps = default;
            Optional <IDictionary <string, CustomOpenIdConnectProvider> > customOpenIdConnectProviders = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("azureActiveDirectory"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    azureActiveDirectory = AzureActiveDirectory.DeserializeAzureActiveDirectory(property.Value);
                    continue;
                }
                if (property.NameEquals("facebook"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    facebook = FacebookProvider.DeserializeFacebookProvider(property.Value);
                    continue;
                }
                if (property.NameEquals("gitHub"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    gitHub = GitHubProvider.DeserializeGitHubProvider(property.Value);
                    continue;
                }
                if (property.NameEquals("google"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    google = GoogleProvider.DeserializeGoogleProvider(property.Value);
                    continue;
                }
                if (property.NameEquals("twitter"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    twitter = TwitterProvider.DeserializeTwitterProvider(property.Value);
                    continue;
                }
                if (property.NameEquals("apple"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    apple = AppleProvider.DeserializeAppleProvider(property.Value);
                    continue;
                }
                if (property.NameEquals("azureStaticWebApps"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    azureStaticWebApps = AzureStaticWebApps.DeserializeAzureStaticWebApps(property.Value);
                    continue;
                }
                if (property.NameEquals("customOpenIdConnectProviders"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, CustomOpenIdConnectProvider> dictionary = new Dictionary <string, CustomOpenIdConnectProvider>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, CustomOpenIdConnectProvider.DeserializeCustomOpenIdConnectProvider(property0.Value));
                    }
                    customOpenIdConnectProviders = dictionary;
                    continue;
                }
            }
            return(new IdentityProviders(azureActiveDirectory.Value, facebook.Value, gitHub.Value, google.Value, twitter.Value, apple.Value, azureStaticWebApps.Value, Optional.ToDictionary(customOpenIdConnectProviders)));
        }