-
Notifications
You must be signed in to change notification settings - Fork 944
Add support for validating passwords against the password policy in auth #7514
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
c622c1f
Add password policy endpoint in auth
ch5zzy 1741fef
Implement password policy caching in auth object
ch5zzy 8be31e5
Update password policy in sign up flow (#7392)
ch5zzy 3a7c4a3
Define validatePassword endpoint for public API (#7409)
ch5zzy e40b1e7
Define internal password policy typings (#7446)
ch5zzy ca662bd
Define implementation of internal password policy class (#7447)
ch5zzy 97f46f5
Update Auth to use PasswordPolicyImpl for validation (#7451)
ch5zzy d40ca7d
Implement validatePassword endpoint and fix PasswordPolicy type to ma…
ch5zzy 1025840
Update password policy cache in reset password flow when the password…
ch5zzy 1532012
Update password policy cache in sign-in flow when the password does n…
ch5zzy 5ef98ff
Include the character option statuses even when an empty string is in…
ch5zzy a70a9ac
Update auth demo to include password validation (#7472)
ch5zzy defdb66
Add enforcementState and forceUpgradeOnSignin to PasswordPolicy type …
ch5zzy 2f51103
Fix bug when non-alphanumeric characters is undefined in password pol…
ch5zzy 57ed176
Update password validation in auth demo to be in each auth flow with …
ch5zzy 137b0b7
Use a default minimum password length of 6 (#7499)
ch5zzy 642259b
Add password policy integration tests (#7489)
ch5zzy 3aa18f7
Add changeset for password policy (#7511)
ch5zzy 58460a1
Fix password policy recaching in sign up (#7506)
ch5zzy 5f4b375
Merge branch 'master' into password-policy
ch5zzy de6e231
Fix formatting in auth tests
ch5zzy fcb7049
Fix spelling for updatePasswordCharacterOptionsStatuses
ch5zzy 7ad5a8d
Merge branch 'master' into password-policy
ch5zzy 40e3f69
Add _castAuth import back to index.ts and fix broken tests
ch5zzy 1bb7d0a
Update docstrings for PasswordPolicy and PasswordValidationStatus
ch5zzy fbd258c
Add 'firebase' to changeset
ch5zzy 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@firebase/auth': minor | ||
'firebase': minor | ||
--- | ||
|
||
Add a validatePassword method for validating passwords against the password policy configured for the project or a tenant. This method returns a status object that can be used to display the requirements of the password policy and whether each one was met. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
Project: /docs/reference/js/_project.yaml | ||
Book: /docs/reference/_book.yaml | ||
page_type: reference | ||
|
||
{% comment %} | ||
DO NOT EDIT THIS FILE! | ||
This is generated by the JS SDK team, and any local changes will be | ||
overwritten. Changes should be made in the source code at | ||
https://github.com/firebase/firebase-js-sdk | ||
{% endcomment %} | ||
|
||
# PasswordPolicy interface | ||
A structure specifying password policy requirements. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface PasswordPolicy | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [allowedNonAlphanumericCharacters](./auth.passwordpolicy.md#passwordpolicyallowednonalphanumericcharacters) | string | List of characters that are considered non-alphanumeric during validation. | | ||
| [customStrengthOptions](./auth.passwordpolicy.md#passwordpolicycustomstrengthoptions) | { readonly minPasswordLength?: number; readonly maxPasswordLength?: number; readonly containsLowercaseLetter?: boolean; readonly containsUppercaseLetter?: boolean; readonly containsNumericCharacter?: boolean; readonly containsNonAlphanumericCharacter?: boolean; } | Requirements enforced by this password policy. | | ||
| [enforcementState](./auth.passwordpolicy.md#passwordpolicyenforcementstate) | string | The enforcement state of the policy. Can be 'OFF' or 'ENFORCE'. | | ||
| [forceUpgradeOnSignin](./auth.passwordpolicy.md#passwordpolicyforceupgradeonsignin) | boolean | Whether existing passwords must meet the policy. | | ||
|
||
## PasswordPolicy.allowedNonAlphanumericCharacters | ||
|
||
List of characters that are considered non-alphanumeric during validation. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly allowedNonAlphanumericCharacters: string; | ||
``` | ||
|
||
## PasswordPolicy.customStrengthOptions | ||
|
||
Requirements enforced by this password policy. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly customStrengthOptions: { | ||
readonly minPasswordLength?: number; | ||
readonly maxPasswordLength?: number; | ||
readonly containsLowercaseLetter?: boolean; | ||
readonly containsUppercaseLetter?: boolean; | ||
readonly containsNumericCharacter?: boolean; | ||
readonly containsNonAlphanumericCharacter?: boolean; | ||
}; | ||
``` | ||
|
||
## PasswordPolicy.enforcementState | ||
|
||
The enforcement state of the policy. Can be 'OFF' or 'ENFORCE'. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly enforcementState: string; | ||
``` | ||
|
||
## PasswordPolicy.forceUpgradeOnSignin | ||
|
||
Whether existing passwords must meet the policy. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly forceUpgradeOnSignin: boolean; | ||
``` |
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,112 @@ | ||
Project: /docs/reference/js/_project.yaml | ||
Book: /docs/reference/_book.yaml | ||
page_type: reference | ||
|
||
{% comment %} | ||
DO NOT EDIT THIS FILE! | ||
This is generated by the JS SDK team, and any local changes will be | ||
overwritten. Changes should be made in the source code at | ||
https://github.com/firebase/firebase-js-sdk | ||
{% endcomment %} | ||
|
||
# PasswordValidationStatus interface | ||
A structure indicating which password policy requirements were met or violated and what the requirements are. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface PasswordValidationStatus | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [containsLowercaseLetter](./auth.passwordvalidationstatus.md#passwordvalidationstatuscontainslowercaseletter) | boolean | Whether the password contains a lowercase letter, or undefined if not required. | | ||
| [containsNonAlphanumericCharacter](./auth.passwordvalidationstatus.md#passwordvalidationstatuscontainsnonalphanumericcharacter) | boolean | Whether the password contains a non-alphanumeric character, or undefined if not required. | | ||
| [containsNumericCharacter](./auth.passwordvalidationstatus.md#passwordvalidationstatuscontainsnumericcharacter) | boolean | Whether the password contains a numeric character, or undefined if not required. | | ||
| [containsUppercaseLetter](./auth.passwordvalidationstatus.md#passwordvalidationstatuscontainsuppercaseletter) | boolean | Whether the password contains an uppercase letter, or undefined if not required. | | ||
| [isValid](./auth.passwordvalidationstatus.md#passwordvalidationstatusisvalid) | boolean | Whether the password meets all requirements. | | ||
| [meetsMaxPasswordLength](./auth.passwordvalidationstatus.md#passwordvalidationstatusmeetsmaxpasswordlength) | boolean | Whether the password meets the maximum password length, or undefined if not required. | | ||
| [meetsMinPasswordLength](./auth.passwordvalidationstatus.md#passwordvalidationstatusmeetsminpasswordlength) | boolean | Whether the password meets the minimum password length, or undefined if not required. | | ||
| [passwordPolicy](./auth.passwordvalidationstatus.md#passwordvalidationstatuspasswordpolicy) | [PasswordPolicy](./auth.passwordpolicy.md#passwordpolicy_interface) | The policy used to validate the password. | | ||
|
||
## PasswordValidationStatus.containsLowercaseLetter | ||
|
||
Whether the password contains a lowercase letter, or undefined if not required. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly containsLowercaseLetter?: boolean; | ||
``` | ||
|
||
## PasswordValidationStatus.containsNonAlphanumericCharacter | ||
|
||
Whether the password contains a non-alphanumeric character, or undefined if not required. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly containsNonAlphanumericCharacter?: boolean; | ||
``` | ||
|
||
## PasswordValidationStatus.containsNumericCharacter | ||
|
||
Whether the password contains a numeric character, or undefined if not required. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly containsNumericCharacter?: boolean; | ||
``` | ||
|
||
## PasswordValidationStatus.containsUppercaseLetter | ||
|
||
Whether the password contains an uppercase letter, or undefined if not required. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly containsUppercaseLetter?: boolean; | ||
``` | ||
|
||
## PasswordValidationStatus.isValid | ||
|
||
Whether the password meets all requirements. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly isValid: boolean; | ||
``` | ||
|
||
## PasswordValidationStatus.meetsMaxPasswordLength | ||
|
||
Whether the password meets the maximum password length, or undefined if not required. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly meetsMaxPasswordLength?: boolean; | ||
``` | ||
|
||
## PasswordValidationStatus.meetsMinPasswordLength | ||
|
||
Whether the password meets the minimum password length, or undefined if not required. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly meetsMinPasswordLength?: boolean; | ||
``` | ||
|
||
## PasswordValidationStatus.passwordPolicy | ||
|
||
The policy used to validate the password. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly passwordPolicy: PasswordPolicy; | ||
``` |
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.
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.