-
Notifications
You must be signed in to change notification settings - Fork 268
feat(auth): Add MFA info to UserRecord #422
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
5 commits
Select commit
Hold shift + click to select a range
40f6cc4
Add MFA info to UserRecord
jasperkuperus ba27138
Add parity in auth MFA naming with other admin-sdk libraries
jasperkuperus 0ce2df3
Add comments, satisfy linting
jasperkuperus 2b6f249
Process MFA review remarks
jasperkuperus 97414a2
Merge branch 'dev' into mfa-info
hiranya911 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,55 @@ var testUser = &UserRecord{ | |
}, | ||
CustomClaims: map[string]interface{}{"admin": true, "package": "gold"}, | ||
TenantID: "testTenant", | ||
MultiFactor: &MultiFactorSettings{ | ||
EnrolledFactors: []*MultiFactorInfo{ | ||
{ | ||
UID: "0aaded3f-5e73-461d-aef9-37b48e3769be", | ||
FactorID: Phone, | ||
EnrollmentTimestamp: 1614776780000, | ||
PhoneNumber: "+1234567890", | ||
DisplayName: "My MFA Phone", | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
var emptyFactors []*MultiFactorInfo | ||
var testUserWithoutMFA = &UserRecord{ | ||
UserInfo: &UserInfo{ | ||
UID: "testusernomfa", | ||
Email: "[email protected]", | ||
PhoneNumber: "+1234567890", | ||
DisplayName: "Test User Without MFA", | ||
PhotoURL: "http://www.example.com/testusernomfa/photo.png", | ||
ProviderID: defaultProviderID, | ||
}, | ||
Disabled: false, | ||
|
||
EmailVerified: true, | ||
ProviderUserInfo: []*UserInfo{ | ||
{ | ||
ProviderID: "password", | ||
DisplayName: "Test User Without MFA", | ||
PhotoURL: "http://www.example.com/testusernomfa/photo.png", | ||
Email: "[email protected]", | ||
UID: "testuid", | ||
}, { | ||
ProviderID: "phone", | ||
PhoneNumber: "+1234567890", | ||
UID: "testuid", | ||
}, | ||
}, | ||
TokensValidAfterMillis: 1494364393000, | ||
UserMetadata: &UserMetadata{ | ||
CreationTimestamp: 1234567890000, | ||
LastLogInTimestamp: 1233211232000, | ||
}, | ||
CustomClaims: map[string]interface{}{"admin": true, "package": "gold"}, | ||
TenantID: "testTenant", | ||
MultiFactor: &MultiFactorSettings{ | ||
EnrolledFactors: emptyFactors, | ||
}, | ||
} | ||
|
||
func TestGetUser(t *testing.T) { | ||
|
@@ -501,7 +550,7 @@ func TestListUsers(t *testing.T) { | |
want := []*ExportedUserRecord{ | ||
{UserRecord: testUser, PasswordHash: "passwordhash1", PasswordSalt: "salt1"}, | ||
{UserRecord: testUser, PasswordHash: "passwordhash2", PasswordSalt: "salt2"}, | ||
{UserRecord: testUser, PasswordHash: "passwordhash3", PasswordSalt: "salt3"}, | ||
{UserRecord: testUserWithoutMFA, PasswordHash: "passwordhash3", PasswordSalt: "salt3"}, | ||
} | ||
|
||
testIterator := func(iter *UserIterator, token string, req string) { | ||
|
@@ -1596,6 +1645,14 @@ func TestMakeExportedUser(t *testing.T) { | |
PhoneNumber: "+1234567890", | ||
UID: "testuid", | ||
}}, | ||
MFAInfo: []*multiFactorInfoResponse{ | ||
{ | ||
PhoneInfo: "+1234567890", | ||
MFAEnrollmentID: "0aaded3f-5e73-461d-aef9-37b48e3769be", | ||
DisplayName: "My MFA Phone", | ||
EnrolledAt: "2021-03-03T13:06:20.542896Z", | ||
}, | ||
}, | ||
} | ||
|
||
want := &ExportedUserRecord{ | ||
|
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
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.