Ejemplo n.º 1
0
        public CookieModel GetSecuredSameSiteLaxMaxageNoValue()
        {
            var context = this.contextResolver.GetContext();

            var model = new CookieModel
            {
                Name          = "AS",
                Value         = null,
                HttpOnly      = false,
                SameSite      = SameSiteCookieValue.Lax,
                Secure        = false,
                MaxAgeSeconds = 10
            };

            context.AddResponseCookie(new ApiCookie
            {
                Name          = model.Name,
                Value         = model.Value,
                HttpOnly      = model.HttpOnly,
                SameSite      = model.SameSite,
                Secure        = model.Secure,
                MaxAgeSeconds = model.MaxAgeSeconds
            });

            return(model);
        }
Ejemplo n.º 2
0
        public CookieModel GetSecuredBareBonesValue()
        {
            var context = this.contextResolver.GetContext();

            var model = new CookieModel
            {
                Name          = "AS",
                Value         = "test",
                HttpOnly      = false,
                SameSite      = SameSiteCookieValue.None,
                Secure        = false,
                MaxAgeSeconds = 0
            };

            context.AddResponseCookie(new ApiCookie
            {
                Name          = model.Name,
                Value         = model.Value,
                HttpOnly      = model.HttpOnly,
                SameSite      = model.SameSite,
                Secure        = model.Secure,
                MaxAgeSeconds = model.MaxAgeSeconds
            });

            return(model);
        }
Ejemplo n.º 3
0
        public CookieModel GetSecuredSameSiteStrictHttpOnlyNoMaxage()
        {
            var context = this.contextResolver.GetContext();

            var model = new CookieModel
            {
                Name     = "AS",
                Value    = "1",
                HttpOnly = true,
                SameSite = SameSiteCookieValue.Strict,
                Secure   = true
            };

            context.AddResponseCookie(new ApiCookie
            {
                Name     = model.Name,
                Value    = model.Value,
                HttpOnly = model.HttpOnly,
                SameSite = model.SameSite,
                Secure   = model.Secure
            });

            return(model);
        }