private void AuthenticateWithToken(Token token) { ClaimsIdentity identity = CreateClaimsIdentity(token); Microsoft.Owin.Security.IAuthenticationManager authenticationManager = System.Web.HttpContext.Current.GetOwinContext().Authentication; authenticationManager.SignIn(identity); }
public static void Login(PauseIdentity pauseIndentity, bool isPersistant = false) { // var claimsIdentity = new PauseIdentity(userId, username, new List<string> { "user" }); //This uses OWIN authentication AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistant }, pauseIndentity); HttpContext.Current.User = new PausePrincipal(AuthenticationManager.AuthenticationResponseGrant.Principal); }