-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Auth/PM-3813 - 2FA Management Endpoints - User Verification Refactor #7841
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
Draft
JaredSnider-Bitwarden
wants to merge
23
commits into
main
Choose a base branch
from
auth/pm-38137/2fa-verification-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
4631404
PM-38137 - Add TwoFactorUserVerificationTokenable infrastructure
JaredSnider-Bitwarden 168ba73
PM-38137 - Add per-provider 2FA request and response models
JaredSnider-Bitwarden 583efbb
PM-38137 - Refactor TwoFactorController helpers and add per-provider …
JaredSnider-Bitwarden 95c3e88
PM-38137 - Refactor Authenticator 2FA request models to standalone shape
JaredSnider-Bitwarden 1aa95c2
PM-38137 - Simplify VerifySecretAsync
JaredSnider-Bitwarden 3f04a49
PM-38137 - Expand 2FA controller integration test coverage
JaredSnider-Bitwarden 40842fc
PM-38137 - Add bulk-disable endpoint for WebAuthn 2FA provider
JaredSnider-Bitwarden 4d28582
PM-38137 - Expand unit-test coverage for per-provider 2FA disable end…
JaredSnider-Bitwarden aaf3631
PM-38137 - Rename 2FA controller disable endpoints to delete
JaredSnider-Bitwarden dd7d50a
PM-38137 - TwoFactorController - add TODO for cleaning up obsolete en…
JaredSnider-Bitwarden 7846bd6
PM-38137 - Tighten WebAuthn 2FA request model validation
JaredSnider-Bitwarden ec2d477
PM-38137 - Tighten Duo and YubiKey 2FA request model validation
JaredSnider-Bitwarden ee0798f
PM-38137 - Delete unreferenced TwoFactorRecoveryRequestModel
JaredSnider-Bitwarden f0991a6
PM-38137 - Split Email 2FA request models by flow
JaredSnider-Bitwarden 9884f1b
PM-38137 - Refine TwoFactorUserVerificationTokenable doc summary
JaredSnider-Bitwarden 6913a65
PM-38137 - Dispose JsonDocument in 2FA integration test helper
JaredSnider-Bitwarden 5c1884f
PM-38137 - Expand unit-test coverage for PutYubiKey, PutWebAuthn, and…
JaredSnider-Bitwarden aef933f
PM-38137 - Organize 2FA controller unit tests into provider-grouped s…
JaredSnider-Bitwarden 3a92642
PM-38137 - Add 2FA feature-area README with user-verification design
JaredSnider-Bitwarden 15913df
PM-38137 - Rename 2FA request models to TwoFactor<Provider><Verb> shape
JaredSnider-Bitwarden 6112806
PM-38137 - Rename stale CheckAsync/CheckOrganizationAsync test refere…
JaredSnider-Bitwarden 92bbc11
PM-38137 - Tidy 2FA controller test helpers
JaredSnider-Bitwarden 915a5e8
PM-38137 - Reword 2FA request model summaries to describe purpose
JaredSnider-Bitwarden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
src/Api/Auth/Models/Request/TwoFactorDuoDeleteRequestModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| using System.ComponentModel.DataAnnotations; | ||
|
|
||
| namespace Bit.Api.Auth.Models.Request; | ||
|
|
||
| /// <summary>Request model for deleting a user's Duo two-factor configuration.</summary> | ||
| public class TwoFactorDuoDeleteRequestModel | ||
| { | ||
| /// <summary>Token minted by <c>GetDuo</c>; bound to <c>UserId + ProviderType</c>.</summary> | ||
| [Required] | ||
| public string UserVerificationToken { get; set; } = null!; | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/Api/Auth/Models/Request/TwoFactorEmailDeleteRequestModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| using System.ComponentModel.DataAnnotations; | ||
|
|
||
| namespace Bit.Api.Auth.Models.Request; | ||
|
|
||
| /// <summary>Request model for deleting a user's Email two-factor configuration.</summary> | ||
| public class TwoFactorEmailDeleteRequestModel | ||
| { | ||
| /// <summary>Token minted by <c>GetEmail</c>; bound to <c>UserId + ProviderType</c>.</summary> | ||
| [Required] | ||
| public string UserVerificationToken { get; set; } = null!; | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/Api/Auth/Models/Request/TwoFactorOrganizationDuoDeleteRequestModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| using System.ComponentModel.DataAnnotations; | ||
|
|
||
| namespace Bit.Api.Auth.Models.Request; | ||
|
|
||
| /// <summary>Request model for deleting an organization's Duo two-factor configuration.</summary> | ||
| public class TwoFactorOrganizationDuoDeleteRequestModel | ||
| { | ||
| /// <summary>Token minted by <c>GetOrganizationDuo</c>; bound to <c>UserId + ProviderType</c>.</summary> | ||
| [Required] | ||
| public string UserVerificationToken { get; set; } = null!; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Api/Auth/Models/Request/TwoFactorWebAuthnDeleteAllRequestModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| using System.ComponentModel.DataAnnotations; | ||
|
|
||
| namespace Bit.Api.Auth.Models.Request; | ||
|
|
||
| /// <summary>Request model for deleting all of a user's WebAuthn two-factor credentials.</summary> | ||
| public class TwoFactorWebAuthnDeleteAllRequestModel | ||
| { | ||
| /// <summary>Token minted by <c>GetWebAuthn</c>; bound to <c>UserId + ProviderType</c>.</summary> | ||
| [Required] | ||
| public string UserVerificationToken { get; set; } = null!; | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/Api/Auth/Models/Request/TwoFactorYubiKeyDeleteRequestModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| using System.ComponentModel.DataAnnotations; | ||
|
|
||
| namespace Bit.Api.Auth.Models.Request; | ||
|
|
||
| /// <summary>Request model for deleting a user's YubiKey two-factor configuration.</summary> | ||
| public class TwoFactorYubiKeyDeleteRequestModel | ||
| { | ||
| /// <summary>Token minted by <c>GetYubiKey</c>; bound to <c>UserId + ProviderType</c>.</summary> | ||
| [Required] | ||
| public string UserVerificationToken { get; set; } = null!; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/Api/Auth/Models/Response/TwoFactor/TwoFactorWebAuthnChallengeResponseModel.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| using Bit.Core.Models.Api; | ||
| using Fido2NetLib; | ||
|
|
||
| namespace Bit.Api.Auth.Models.Response.TwoFactor; | ||
|
|
||
| /// <summary> | ||
| /// Envelope around <see cref="CredentialCreateOptions"/> that adds the user-verification token. | ||
| /// </summary> | ||
| public class TwoFactorWebAuthnChallengeResponseModel : ResponseModel | ||
| { | ||
| public TwoFactorWebAuthnChallengeResponseModel() | ||
| : base("twoFactorWebAuthnChallenge") | ||
| { | ||
| } | ||
|
|
||
| /// <summary>FIDO2 registration ceremony options; passed straight to <c>navigator.credentials.create()</c>.</summary> | ||
| public CredentialCreateOptions Options { get; set; } = null!; | ||
|
|
||
| /// <summary>Token to replay on the subsequent PUT so the user does not have to re-verify.</summary> | ||
| public string UserVerificationToken { get; set; } = null!; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/Core/Auth/Models/Business/Tokenables/ITwoFactorUserVerificationTokenableFactory.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| using Bit.Core.Auth.Enums; | ||
| using Bit.Core.Entities; | ||
|
|
||
| namespace Bit.Core.Auth.Models.Business.Tokenables; | ||
|
|
||
| /// <summary>Mints <see cref="TwoFactorUserVerificationTokenable"/> instances with the operator-configured lifetime.</summary> | ||
| public interface ITwoFactorUserVerificationTokenableFactory | ||
| { | ||
| /// <summary>Creates a token bound to the given user and provider, expiring after the configured lifetime.</summary> | ||
| TwoFactorUserVerificationTokenable CreateToken(User user, TwoFactorProviderType providerType); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.