Example #1
0
        public ActionResult TailspinSignIn(KirnauSignInViewModel signInInfo)
        {
            var ctx = System.Web.HttpContext.Current;

            SimulatedWindowsAuthenticationOperations.LogOnUser(signInInfo.FullName, ctx, ctx.Request, ctx.Response);

            return(this.HandleTailspinSignInResponse(signInInfo.FullName, new Uri(signInInfo.SignInRequest)));
        }
Example #2
0
        private ActionResult HandleTailspinSignInRequest()
        {
            var ctx = System.Web.HttpContext.Current;

            string authenticatedUser;

            if (!SimulatedWindowsAuthenticationOperations.TryToAuthenticateUser(ctx, ctx.Request, ctx.Response, out authenticatedUser))
            {
                return(this.RedirectToAction("TailspinSignIn", new { SignInRequest = ctx.Request.Url.ToString() }));
            }

            return(this.HandleTailspinSignInResponse(authenticatedUser, ctx.Request.Url));
        }
Example #3
0
        protected override void OnPreRender(EventArgs e)
        {
            string action = Request.QueryString[WSFederationConstants.Parameters.Action];

            try
            {
                if (action == WSFederationConstants.Actions.SignIn)
                {
                    // Process signin request.
                    string endpointAddress = "~/SimulatedWindowsAuthentication.aspx";
                    Response.Redirect(endpointAddress + "?" + Request.QueryString, false);
                }
                else if (action == WSFederationConstants.Actions.SignOut)
                {
                    // Process signout request.
                    SimulatedWindowsAuthenticationOperations.LogOutUser(this.Request, this.Response);
                    SignOutRequestMessage requestMessage = (SignOutRequestMessage)WSFederationMessage.CreateFromUri(Request.Url);
                    FederatedPassiveSecurityTokenServiceOperations.ProcessSignOutRequest(requestMessage, this.User, null, this.Response);
                    this.ActionExplanationLabel.Text = "Sign out from the issuer has been requested.";
                }
                else
                {
                    throw new InvalidOperationException(
                              string.Format(
                                  CultureInfo.InvariantCulture,
                                  "The action '{0}' (Request.QueryString['{1}']) is unexpected. Expected actions are: '{2}' or '{3}'.",
                                  string.IsNullOrEmpty(action) ? "<EMPTY>" : action,
                                  WSFederationConstants.Parameters.Action,
                                  WSFederationConstants.Actions.SignIn,
                                  WSFederationConstants.Actions.SignOut));
                }
            }
            catch (Exception exception)
            {
                throw new Exception("An unexpected error occurred when processing the request. See inner exception for details.", exception);
            }
        }