示例#1
0
        internal static AzureActiveDirectoryValidation DeserializeAzureActiveDirectoryValidation(JsonElement element)
        {
            Optional <JwtClaimChecks>             jwtClaimChecks             = default;
            Optional <IList <string> >            allowedAudiences           = default;
            Optional <DefaultAuthorizationPolicy> defaultAuthorizationPolicy = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("jwtClaimChecks"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    jwtClaimChecks = JwtClaimChecks.DeserializeJwtClaimChecks(property.Value);
                    continue;
                }
                if (property.NameEquals("allowedAudiences"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    allowedAudiences = array;
                    continue;
                }
                if (property.NameEquals("defaultAuthorizationPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    defaultAuthorizationPolicy = DefaultAuthorizationPolicy.DeserializeDefaultAuthorizationPolicy(property.Value);
                    continue;
                }
            }
            return(new AzureActiveDirectoryValidation(jwtClaimChecks.Value, Optional.ToList(allowedAudiences), defaultAuthorizationPolicy.Value));
        }
 internal AzureActiveDirectoryValidation(JwtClaimChecks jwtClaimChecks, IList <string> allowedAudiences, DefaultAuthorizationPolicy defaultAuthorizationPolicy)
 {
     JwtClaimChecks             = jwtClaimChecks;
     AllowedAudiences           = allowedAudiences;
     DefaultAuthorizationPolicy = defaultAuthorizationPolicy;
 }