コード例 #1
0
ファイル: FormsAuth.cs プロジェクト: bradtwurst/lokad-cqrs
        public ActionResult HandleLogin(SessionIdentity account, bool persistCookie, Action onSessionInit, string url)
        {
            GlobalState.InitializeSession(account);

            onSessionInit();
            FormsAuthentication.SetAuthCookie(account.CookieString, persistCookie);

            if (string.IsNullOrEmpty(url))
            {
                url = FormsAuthentication.GetRedirectUrl(account.CookieString, persistCookie);
                // this one crashes dev fabric
                //FormsAuthentication.RedirectFromLoginPage(username, persistCookie);
            }
            // we might need to unencode
            while (url.StartsWith("%"))
            {
                url = Uri.UnescapeDataString(url);
            }
            // this is MVC app, so no default.aspx any more
            if (url.EndsWith("/default.aspx"))
            {
                url = null;
            }

            if (string.IsNullOrEmpty(url))
            {
                // web site might be located in the nested folder
                url = HttpContext.Current.Request.ApplicationPath;
            }

            return new RedirectResult(url, false);
        }
コード例 #2
0
        public ActionResult HandleLogin(SessionIdentity account, bool persistCookie, Action onSessionInit, string url)
        {
            GlobalState.InitializeSession(account);

            onSessionInit();
            FormsAuthentication.SetAuthCookie(account.CookieString, persistCookie);

            if (string.IsNullOrEmpty(url))
            {
                url = FormsAuthentication.GetRedirectUrl(account.CookieString, persistCookie);
                // this one crashes dev fabric
                //FormsAuthentication.RedirectFromLoginPage(username, persistCookie);
            }
            // we might need to unencode
            while (url.StartsWith("%"))
            {
                url = Uri.UnescapeDataString(url);
            }
            // this is MVC app, so no default.aspx any more
            if (url.EndsWith("/default.aspx"))
            {
                url = null;
            }

            if (string.IsNullOrEmpty(url))
            {
                // web site might be located in the nested folder
                url = HttpContext.Current.Request.ApplicationPath;
            }

            return(new RedirectResult(url, false));
        }
コード例 #3
0
 /// <summary>
 /// Single point of entry to initialize the session
 /// </summary>
 /// <param name="accountSession">The account session.</param>
 public static void InitializeSession(SessionIdentity accountSession)
 {
     var session = HttpContext.Current.Session;
     session[AccountSessionKey] = accountSession;
 }
コード例 #4
0
 public AuthenticationResult(SessionIdentity identity)
 {
     Identity = identity;
     IsSuccess = true;
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthPrincipal"/> class.
 /// </summary>
 /// <param name="account">The account.</param>
 public AuthPrincipal(SessionIdentity account)
 {
     Identity = account;
     _identity = new GenericIdentity(account.SessionDisplay);
 }
コード例 #6
0
 public ActionResult HandleLogin(SessionIdentity account, bool persistCookie, string redirect = null)
 {
     return(HandleLogin(account, persistCookie,
                        () => { HttpContext.Current.Session["LoginAge"] = DateTime.UtcNow; }, redirect));
 }
コード例 #7
0
ファイル: FormsAuth.cs プロジェクト: bradtwurst/lokad-cqrs
 public ActionResult HandleLogin(SessionIdentity account, bool persistCookie, string redirect = null)
 {
     return HandleLogin(account, persistCookie,
         () => { HttpContext.Current.Session["LoginAge"] = DateTime.UtcNow; }, redirect);
 }
コード例 #8
0
        /// <summary>
        /// Single point of entry to initialize the session
        /// </summary>
        /// <param name="accountSession">The account session.</param>
        public static void InitializeSession(SessionIdentity accountSession)
        {
            var session = HttpContext.Current.Session;

            session[AccountSessionKey] = accountSession;
        }
コード例 #9
0
ファイル: SessionIdentity.cs プロジェクト: deke/lokad-cqrs
 public AuthenticationResult(SessionIdentity identity)
 {
     Identity  = identity;
     IsSuccess = true;
 }
コード例 #10
0
ファイル: SessionIdentity.cs プロジェクト: deke/lokad-cqrs
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthPrincipal"/> class.
 /// </summary>
 /// <param name="account">The account.</param>
 public AuthPrincipal(SessionIdentity account)
 {
     Identity  = account;
     _identity = new GenericIdentity(account.SessionDisplay);
 }