Tuesday, February 7, 2017

How to read MVC OWIN AuthenticationProperties?

Leave a Comment

I'm setting IsPersistent when signing the user in, how to read that value back?

var identity = await UserManager.CreateIdentityAsync(appUser, DefaultAuthenticationTypes.ApplicationCookie); HttpContext.GetOwinContext().Authentication.SignIn(new AuthenticationProperties() { IsPersistent = false }, identity); 

1 Answers

Answers 1

Since there isn't much description, I am not sure about the context. Anyway, you can get all the AuthenticationProperties that were provided with the sign in call when you perform authentication on the current request. Code would be..

AuthenticateResult authenticateResult = await HttpContext.GetOwinContext().Authentication.AuthenticateAsync(DefaultAuthenticationTypes.ApplicationCookie);  AuthenticationProperties yourAuthenticationProperties = authenticateResult.Properties; 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment