Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.Net Identity with 2FA: List of Trusted Browsers

I'm working on a project with Asp.Net MVC 5 and Asp.Net Identity and I'm using two factor authentication. For the login I use:

var result = await SignInManager.TwoFactorSignInAsync(model.Provider, model.Code, isPersistent: model.RememberMe, rememberBrowser: model.RememberBrowser);

which is the default code that came with the new project. However, I also need the ability for a user to "trust" or "remember" a browser, similar to how banks can indicate if this was the first time you have signed in from a particular browser/pc.

My question is around the RememberBrowser property on the sign in method and what .NET Identity does with this data. I want the list of saved browsers and the ability to revoke access to one/and-or all of them. Is that possible within the Identity framework? Also, can I tell if a browser has been "trusted" before by some type of lookup?

Edit:

Maybe it's a good idea to save the browser info in the database and check on login instead of the cookie? That way it can be shown as a list with the ability to delete it. What I'm looking for is what to save and how to integrate it with the Asp.Net Identity without having a security risk.

Edit 2

Here's an example from a website that is already using this: Browser list

Edit 3

Maybe this can be implemented as another step for authentication. So basically we'll have a 3 factor authentication:

  • First user logs in with user/pass
  • Then we'll check if the 2FA is enabled and get the code if necessary
  • We get the user's aser agent and IP and check the database if it's new. Then notify if necessary.

So I'm guessing an new cookie should be added to save browser's info. However, we should be able to invalidate this cookie along with the 2FA cookie.

like image 820
Alireza Noori Avatar asked Dec 19 '16 17:12

Alireza Noori


1 Answers

RememberBrowser sets a cookie that allows the 2FA step to be skipped. There is no central way to track this though it would be easy enough to log, however the results may not be accurate because people can delete cookies manually. There's no way to invalidate it I believe but it doesn't really matter as you can invalidate their session and the user is will be required to login with their password again.

like image 195
Daniel Avatar answered Oct 02 '22 04:10

Daniel