Esempio n. 1
0
        private CookieOptions CreateCookieOptions(bool?persistent, DateTimeOffset?expires = null)
        {
            var secure = _context.HttpContext.Request.IsHttps;
            var path   = _context.GetBasePath().CleanUrlPath();

            var options = new CookieOptions
            {
                HttpOnly = false,
                Secure   = secure,
                Path     = path
            };

            // todo: load authN cookie and copy its values for persistent/expiration
            //if (persistent != false)
            //{
            //    if (persistent == true || _context.Options.AuthenticationOptions.CookieAuthenticationOptions.IsPersistent)
            //    {
            //        if (persistent == true)
            //        {
            //            expires = expires ?? DateTimeHelper.UtcNow.Add(this.identityServerOptions.AuthenticationOptions.CookieOptions.RememberMeDuration);
            //        }
            //        else
            //        {
            //            expires = expires ?? DateTimeHelper.UtcNow.Add(this.identityServerOptions.AuthenticationOptions.CookieOptions.ExpireTimeSpan);
            //        }
            //        options.Expires = expires.Value.UtcDateTime;
            //    }
            //}

            return(options);
        }
 /// <summary>
 /// Gets the public base URL for IdentityServer.
 /// </summary>
 /// <param name="env">The OWIN environment.</param>
 /// <returns></returns>
 public static string GetIdentityServerBaseUrl(this IdentityServerContext context)
 {
     return(context.GetHost() + context.GetBasePath());
 }