internal ContainerAppLogin(LoginRoutes routes, bool?preserveUrlFragmentsForLogins, IList <string> allowedExternalRedirectUrls, CookieExpiration cookieExpiration, LoginNonce nonce)
 {
     Routes = routes;
     PreserveUrlFragmentsForLogins = preserveUrlFragmentsForLogins;
     AllowedExternalRedirectUrls   = allowedExternalRedirectUrls;
     CookieExpiration = cookieExpiration;
     Nonce            = nonce;
 }
Example #2
0
        internal static ContainerAppLogin DeserializeContainerAppLogin(JsonElement element)
        {
            Optional <LoginRoutes>      routes = default;
            Optional <bool>             preserveUrlFragmentsForLogins = default;
            Optional <IList <string> >  allowedExternalRedirectUrls   = default;
            Optional <CookieExpiration> cookieExpiration = default;
            Optional <LoginNonce>       nonce            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("routes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    routes = LoginRoutes.DeserializeLoginRoutes(property.Value);
                    continue;
                }
                if (property.NameEquals("preserveUrlFragmentsForLogins"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    preserveUrlFragmentsForLogins = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("allowedExternalRedirectUrls"))
                {
                    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());
                    }
                    allowedExternalRedirectUrls = array;
                    continue;
                }
                if (property.NameEquals("cookieExpiration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    cookieExpiration = CookieExpiration.DeserializeCookieExpiration(property.Value);
                    continue;
                }
                if (property.NameEquals("nonce"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    nonce = LoginNonce.DeserializeLoginNonce(property.Value);
                    continue;
                }
            }
            return(new ContainerAppLogin(routes.Value, Optional.ToNullable(preserveUrlFragmentsForLogins), Optional.ToList(allowedExternalRedirectUrls), cookieExpiration.Value, nonce.Value));
        }