public void HasNameAndId() { TadmapIdentity identity = new TadmapIdentity("Name", "Display Name", Guid.Empty, string.Empty); Assert.AreEqual("Name", identity.Name); Assert.AreEqual("Display Name", identity.DisplayName); Assert.AreEqual(Guid.Empty, identity.Id); }
protected void Application_AuthenticateRequest(Object sender, EventArgs e) { HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); CookieUserData userData = CookieUserData.Parse(authTicket.UserData); var identity = new TadmapIdentity(authTicket.Name, userData.DisplayName, userData.Id, "Forms"); Context.User = new GenericPrincipal(identity, userData.Roles); } }