-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Auth/poc/master password service example #7349
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
Patrick-Pimentel-Bitwarden
wants to merge
21
commits into
main
Choose a base branch
from
auth/poc/master-password-service-example
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
21 commits
Select commit
Hold shift + click to select a range
5ad515b
feat(master-password): Master Password Service - Initial implementation.
Patrick-Pimentel-Bitwarden 41bdd72
misc changes, don't put me up
Patrick-Pimentel-Bitwarden 39c61c7
feat(master-password): Master Password Service - Added data payloads.β¦
Patrick-Pimentel-Bitwarden 2b83f8c
Merge remote-tracking branch 'origin' into auth/poc/master-password-sβ¦
Patrick-Pimentel-Bitwarden d5245b6
feat(master-password): Master Password Service - Changed a comment orβ¦
Patrick-Pimentel-Bitwarden 2c2ef07
feat(master-password): Master Password Service - Master password servβ¦
Patrick-Pimentel-Bitwarden 53d4806
feat(master-password): Master Password Service - Added in more fixes β¦
Patrick-Pimentel-Bitwarden 380035d
Merge branch 'main' into auth/poc/master-password-service-example
Patrick-Pimentel-Bitwarden f31c6c4
feat(master-password): Master Password Service - Added in more changeβ¦
Patrick-Pimentel-Bitwarden 0cd0954
Merge remote-tracking branch 'origin' into auth/poc/master-password-sβ¦
Patrick-Pimentel-Bitwarden 909ea5a
feat(master-password): Master Password Service - Lots of misc changesβ¦
Patrick-Pimentel-Bitwarden 3f6a1e0
feat(master-password): Master Password Service - Removed commands andβ¦
Patrick-Pimentel-Bitwarden 8385cae
feat(master-password): Master Password Service - Fixed validation error
Patrick-Pimentel-Bitwarden cb98256
feat(master-password): Master Password Service - Made changed to the β¦
Patrick-Pimentel-Bitwarden 8fb2b71
feat(master-password): Master Password Service - Fixes to the self seβ¦
Patrick-Pimentel-Bitwarden c6331ba
feat(master-password): Master Password Service - Added update temp paβ¦
Patrick-Pimentel-Bitwarden 9252b93
Merge remote-tracking branch 'origin' into auth/poc/master-password-sβ¦
Patrick-Pimentel-Bitwarden 6f80b6d
test(master-password): Master Password Service - Updated the change kβ¦
Patrick-Pimentel-Bitwarden d527c60
fix(master-password): Master Password Service - Updated update-temp-pβ¦
Patrick-Pimentel-Bitwarden 6feb4ce
fix(master-password): Master Password Service - Updated accounts contβ¦
Patrick-Pimentel-Bitwarden 4d942f3
fix(master-password): Master Password Service - Fixed master passwordβ¦
Patrick-Pimentel-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
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
39 changes: 39 additions & 0 deletions
39
src/Api/Auth/Models/Request/Accounts/ChangeKdfRequestModel.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,39 @@ | ||
| ο»Ώusing System.ComponentModel.DataAnnotations; | ||
| using Bit.Core.KeyManagement.Models.Api.Request; | ||
|
|
||
| namespace Bit.Api.Auth.Models.Request.Accounts; | ||
|
|
||
| public class ChangeKdfRequestModel : IValidatableObject | ||
| { | ||
| [Required] | ||
| public required string MasterPasswordHash { get; set; } | ||
| [Obsolete("To be removed in PM-33141")] | ||
| [StringLength(300)] | ||
| public string? NewMasterPasswordHash { get; set; } | ||
| [Obsolete("To be removed in PM-33141")] | ||
| public string? Key { get; set; } | ||
|
|
||
| public MasterPasswordAuthenticationDataRequestModel? AuthenticationData { get; set; } | ||
| public MasterPasswordUnlockDataRequestModel? UnlockData { get; set; } | ||
|
|
||
| // To be removed in PM-33141 | ||
| public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | ||
| { | ||
| var hasNewPayloads = AuthenticationData is not null && UnlockData is not null; | ||
| var hasLegacyPayloads = NewMasterPasswordHash is not null && Key is not null; | ||
|
|
||
| if (hasNewPayloads && hasLegacyPayloads) | ||
| { | ||
| yield return new ValidationResult( | ||
| "Cannot provide both new payloads (UnlockData/AuthenticationData) and legacy payloads (NewMasterPasswordHash/Key).", | ||
| [nameof(AuthenticationData), nameof(UnlockData), nameof(NewMasterPasswordHash), nameof(Key)]); | ||
| } | ||
|
|
||
| if (!hasNewPayloads && !hasLegacyPayloads) | ||
| { | ||
| yield return new ValidationResult( | ||
| "Must provide either new payloads (UnlockData/AuthenticationData) or legacy payloads (NewMasterPasswordHash/Key).", | ||
| [nameof(AuthenticationData), nameof(UnlockData), nameof(NewMasterPasswordHash), nameof(Key)]); | ||
| } | ||
| } | ||
| } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to double check if this will break anything with the sdk