protected void Page_Load(object sender, EventArgs e)
 {
     if (User.Identity.IsAuthenticated)
     {
         FederatedPassiveSecurityTokenServiceOperations.ProcessRequest(Request, User as ClaimsPrincipal, new CustomSecurityTokenServiceConfiguration().CreateSecurityTokenService(), Response);
     }
 }
Exemple #2
0
        /// <summary>
        /// Handles the PreRender event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_PreRender(object sender, EventArgs e)
        {
            IntermediateSecurityTokenServiceConfiguration intermediateSecurityTokenServiceConfiguration = new IntermediateSecurityTokenServiceConfiguration();
            SecurityTokenService securityTokenService = new IntermediateSecurityTokenService(intermediateSecurityTokenServiceConfiguration);

            FederatedPassiveSecurityTokenServiceOperations.ProcessRequest(this.Request, this.User, securityTokenService, this.Response);
            return;
        }
        private ActionResult SignIn(string replyToAddress)
        {
            var user   = HttpContext.Current.User.Identity.IsAuthenticated ? PreviouslyAuthenticated(replyToAddress) : AuthenticateAndCreateCookie(replyToAddress);
            var config = new SecurityTokenServiceConfiguration("http://sts.local", new X509SigningCredentials(LoadCertificate()));

            FederatedPassiveSecurityTokenServiceOperations.ProcessRequest(HttpContext.Current.Request, (ClaimsPrincipal)user, new CustomTokenService(config), HttpContext.Current.Response);
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Exemple #4
0
 public ActionResult Redirect()
 {
     FederatedPassiveSecurityTokenServiceOperations.ProcessRequest(
         System.Web.HttpContext.Current.Request,
         User as ClaimsPrincipal,
         CustomSecurityTokenServiceConfiguration.Current.CreateSecurityTokenService(),
         System.Web.HttpContext.Current.Response);
     return(null);
 }
Exemple #5
0
    void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            string tokenXml = Request.Form["tokenXml"];
            if (!String.IsNullOrEmpty(tokenXml))
            {
                try
                {
                    SecurityToken token = ReadXmlToken(tokenXml);

                    if (token == null)
                    {
                        SetLoginErrorText("Unable to process xml token.");
                    }
                    else
                    {
                        IClaimsPrincipal principal = AuthenticateSecurityToken(Request.RawUrl, token);

                        if (principal == null)
                        {
                            SetLoginErrorText("Unable to authenticate user.");
                        }
                        else
                        {
                            FederatedPassiveSecurityTokenServiceOperations.ProcessRequest(Request, principal, CustomSecurityTokenServiceConfiguration.Current.CreateSecurityTokenService(), Response);
                        }
                    }
                }
                catch (SecurityTokenException exception)
                {
                    SetLoginErrorText(exception.ToString());
                }
            }
        }
    }
Exemple #6
0
 /// <summary>
 /// We perform the WS-Federation Passive Protocol processing in this method.
 /// </summary>
 protected void Page_PreRender(object sender, EventArgs e)
 {
     FederatedPassiveSecurityTokenServiceOperations.ProcessRequest(Request, User, CustomSecurityTokenServiceConfiguration.Current.CreateSecurityTokenService(), Response);
 }
Exemple #7
0
        /// <summary>
        /// We perform the WS-Federation Passive Protocol processing in this method.
        /// </summary>
        protected void Page_PreRender(object sender, EventArgs e)
        {
            ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(User);

            FederatedPassiveSecurityTokenServiceOperations.ProcessRequest(Request, claimsPrincipal, MySecurityTokenServiceConfiguration.Current.CreateSecurityTokenService(), Response);
        }