Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.AspNetCore.Identity UserManager - Delete user AuthenticatorKey and RecoveryCodes #43562

Open
1 task done
Ogglas opened this issue Aug 26, 2022 · 6 comments
Open
1 task done
Labels
area-identity Includes: Identity and providers

Comments

@Ogglas
Copy link

Ogglas commented Aug 26, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I miss a method for deleting AuthenticatorKey and RecoveryCodes for a user in Microsoft.AspNetCore.Identity UserManager. I can control nearly everything else but for some reason there is no method to remove these values.

Describe the solution you'd like

I would like the following methods implemented:

public virtual async Task<IdentityResult> RemoveAuthenticatorKeyAsync(TUser user)

public virtual async Task<IdentityResult> RemoveTwoFactorRecoveryCodesAsync(TUser user)

I know it might be a risk and that the authenticator app will not work until you reconfigure the AuthenticatorKey again etc. However calling ResetAuthenticatorKeyAsync without calling SetTwoFactorEnabledAsync(user, false); or similar will have the same affect imo.

Additional context

No response

@javiercn javiercn added the area-identity Includes: Identity and providers label Aug 26, 2022
@blowdart
Copy link
Contributor

What is your use case for this? You can disable MFA and it'll all get ignored anyway. What does deletion accomplish for you that disabling doesn't?

@blowdart blowdart added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

Hi @Ogglas. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@Ogglas
Copy link
Author

Ogglas commented Aug 30, 2022

@blowdart If a user chooses to disable two-factor authentication I think there should be an alternative to also delete Two-factor authentication keys.

Current functionality:

image

Proposed extra button if a user has keys but not 2FA enabled:

image

A user can of course use Reset authenticator app but that only resets the authenticator key. The database will still keep track of AuthenticatorKey and RecoveryCodes in Table AspNetUserTokens and I think a user should have the possibility to remove these if they want. You can of course fix this via SQL but given that the UserManager handles everything else I think this should be handled as well.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Aug 30, 2022
@blowdart
Copy link
Contributor

Fair enough. We'll think about it for 8.

(But there are a lot of edge case scenarios where usermanager doesn't do it)

@blowdart blowdart removed the Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. label Aug 30, 2022
@blowdart blowdart added this to the .NET 8 Planning milestone Aug 30, 2022
@Flash619
Copy link

Flash619 commented Oct 19, 2023

What is your use case for this? You can disable MFA and it'll all get ignored anyway. What does deletion accomplish for you that disabling doesn't?

I would also like to see this feature.

I currently am working within a system which has the concept of OTP disenrollment. In this case, I would like to also clear any related authentication tokens for that user. This way if OTP is re-enrolled, I do not need to worry about old keys floating around within the system or old authenticators still working.

To mitigate this today, upon OTP disenrollment I reset the authenticator key which feels wrong, as it simply replaces the key in the database instead of removing it entirely.

@tprime1
Copy link

tprime1 commented Jan 21, 2025

What is your use case for this? You can disable MFA and it'll all get ignored anyway. What does deletion accomplish for you that disabling doesn't?

We offer MFA via both email and authenticator app. Many of our users are k-12 students who may or may not have a secondary device during class with which to authenticate. But they will, of course have their primary device. There may be another way to handle this scenario, but I'd like to allow them to be able to remove their AuthenticatorKeys and RecoveryCodes when they mistakenly set up an authenticator app. Removing those would cause their accounts to revert back to what we have as the default MFA method, email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-identity Includes: Identity and providers
Projects
None yet
Development

No branches or pull requests

8 participants
@blowdart @Flash619 @Ogglas @javiercn @tprime1 @mkArtakMSFT and others