Beispiel #1
0
        internal static OptionalClaims DeserializeOptionalClaims(JsonElement element)
        {
            Optional <IList <OptionalClaim> > idToken     = default;
            Optional <IList <OptionalClaim> > accessToken = default;
            Optional <IList <OptionalClaim> > samlToken   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("idToken"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <OptionalClaim> array = new List <OptionalClaim>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(OptionalClaim.DeserializeOptionalClaim(item));
                    }
                    idToken = array;
                    continue;
                }
                if (property.NameEquals("accessToken"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <OptionalClaim> array = new List <OptionalClaim>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(OptionalClaim.DeserializeOptionalClaim(item));
                    }
                    accessToken = array;
                    continue;
                }
                if (property.NameEquals("samlToken"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <OptionalClaim> array = new List <OptionalClaim>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(OptionalClaim.DeserializeOptionalClaim(item));
                    }
                    samlToken = array;
                    continue;
                }
            }
            return(new OptionalClaims(Optional.ToList(idToken), Optional.ToList(accessToken), Optional.ToList(samlToken)));
        }
        internal static OptionalClaims DeserializeOptionalClaims(JsonElement element)
        {
            IList <OptionalClaim> idToken     = default;
            IList <OptionalClaim> accessToken = default;
            IList <OptionalClaim> samlToken   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("idToken"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <OptionalClaim> array = new List <OptionalClaim>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(OptionalClaim.DeserializeOptionalClaim(item));
                        }
                    }
                    idToken = array;
                    continue;
                }
                if (property.NameEquals("accessToken"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <OptionalClaim> array = new List <OptionalClaim>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(OptionalClaim.DeserializeOptionalClaim(item));
                        }
                    }
                    accessToken = array;
                    continue;
                }
                if (property.NameEquals("samlToken"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <OptionalClaim> array = new List <OptionalClaim>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(OptionalClaim.DeserializeOptionalClaim(item));
                        }
                    }
                    samlToken = array;
                    continue;
                }
            }
            return(new OptionalClaims(idToken, accessToken, samlToken));
        }