Ejemplo n.º 1
0
        public static string GenerateLogOutUrlWithReturnUrl()
        {
            var logOutUrl = SitkaRoute <AccountController> .BuildAbsoluteUrlHttpsFromExpression(c => c.LogOff());

            var returnUrl = HttpContext.Current.Request.Url.AbsoluteUri;

            return(OnErrorOrNotFoundPage(returnUrl) ? logOutUrl : String.Format("{0}?returnUrl={1}", logOutUrl, HttpUtility.UrlEncode(returnUrl)));
        }
Ejemplo n.º 2
0
        private static bool OnErrorOrNotFoundPage(string url)
        {
            var returnUrlPathAndQuery   = new Uri(url).PathAndQuery;
            var notFoundUrlPathAndQuery = new Uri(SitkaRoute <HomeController> .BuildAbsoluteUrlHttpsFromExpression(x => x.NotFound())).PathAndQuery;
            var errorUrlPathAndQuery    = new Uri(SitkaRoute <HomeController> .BuildAbsoluteUrlHttpsFromExpression(x => x.Error())).PathAndQuery;

            var onErrorOrNotFoundPage = returnUrlPathAndQuery.StartsWith(notFoundUrlPathAndQuery, StringComparison.InvariantCultureIgnoreCase) ||
                                        returnUrlPathAndQuery.StartsWith(errorUrlPathAndQuery, StringComparison.InvariantCultureIgnoreCase);

            return(onErrorOrNotFoundPage);
        }
Ejemplo n.º 3
0
        public static string GenerateAbsoluteLogInUrl()
        {
            var logInUrl = string.Empty;

            switch (FirmaWebConfiguration.AuthenticationType)
            {
            case AuthenticationType.KeystoneAuth:
                logInUrl = SitkaRoute <AccountController> .BuildAbsoluteUrlHttpsFromExpression(c => c.LogOn());

                break;

            case AuthenticationType.LocalAuth:
                logInUrl = SitkaRoute <LocalAuthenticationController> .BuildAbsoluteUrlHttpsFromExpression(c => c.LocalAuthLogon());

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(logInUrl);
        }