We are working on a ASP.NET vNext project and we are implementing simple cookie-based authentication.
We thought about using the auth-cookie just to verify the user is authenticated. It's created like this:
HttpContext.Authentication.SignInAsync();
The user-object itself would be saved to the session-cache (ISession).
- Is this a practise one could use or are we thinking about this the entirely the wrong way?
- If the basic idea is correct, how do we keep the auth-cookie and the session in sync? (An unauthenticated user with a user-object in the session-cache would be bad)
Note that not only the user-object should be stored in the session. There is a bunch of information that should be stored there (only if the user is authenticated).
Thanks for your input!