Exemplo n.º 1
0
        void Webcsm_PostAuthenticateRequest(object sender, EventArgs e)
        {
            IPrincipal usr = HttpContext.Current.User;

            // If we are dealing with an authenticated forms authentication request
            if (usr.Identity.IsAuthenticated && usr.Identity.AuthenticationType == "Forms")
            {
                FormsIdentity fIdent = usr.Identity as FormsIdentity;

                // Create a CustomIdentity based on the FormsAuthenticationTicket
                WebcsmIdentity ci = new WebcsmIdentity(fIdent.Ticket);

                // Create the CustomPrincipal
                WebcsmPrincipal prin = new WebcsmPrincipal(ci);

                // Attach the CustomPrincipal to HttpContext.User and Thread.CurrentPrincipal
                HttpContext.Current.User = prin;
                Thread.CurrentPrincipal = prin;
            }
        }
Exemplo n.º 2
0
 public WebcsmPrincipal(WebcsmIdentity identity)
 {
     this.identity = identity;
 }