Пример #1
0
 private static OpenIdIdentity CreateFakeIdentity()
 {
     var userData = new Core.DataModel.User();
     var ticket = new FormsAuthenticationTicket(1, "ticket", DateTime.Now,
                                                 DateTime.Now.AddDays(1), false,
                                                 userData.ToString());
     var id = new OpenIdIdentity(ticket);
     return id;
 }
Пример #2
0
        void MvcApplicationPostAuthenticateRequest(object sender, System.EventArgs e)
        {
            try
            {
                var cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

                if (cookie != null)
                {
                    var encodedd = cookie.Value;
                    if (!string.IsNullOrEmpty(encodedd))
                    {
                        FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(encodedd);
                        var id = new OpenIdIdentity(ticket);
                        var principal = new GenericPrincipal(id, null);
                        HttpContext.Current.User = principal;
                    }
                }
            }
            catch
            {
                HttpContext.Current.Response.Cookies.Remove(FormsAuthentication.FormsCookieName);
            }
        }
Пример #3
0
 public void SetUserData(OpenIdIdentity id)
 {
     UserData = id;
 }