Skip to content

feat(auth): Add API to look up users by federated ID. #340

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 6 commits into from
Apr 20, 2021

Conversation

nrsim
Copy link
Contributor

@nrsim nrsim commented Dec 23, 2019

RELEASE NOTE: Added a new getUserByProviderUid() method to lookup user accounts by their providers

@nrsim nrsim requested review from hiranya911 and rsgowman December 23, 2019 20:29
@hiranya911
Copy link
Contributor

In general we don't add APIs to this SDK that are not already present in the Node.js SDK.

@bojeil-google WDYT?

@bojeil-google
Copy link
Contributor

Hey @hiranya911, I plan to review the Node.js implementation these 2 weeks. It's in my backlog. I think @rsgowman's plan was to launch multiple languages together (including the Java implementation).

@hiranya911
Copy link
Contributor

Sounds good. I'll assign to @rsgowman for now. Do we have an API proposal for this?

@bojeil-google
Copy link
Contributor

Yeah, link is at: https://docs.google.com/document/d/1OfN5XH6cYJ7y3AnNsocftQSrbMiMaLlPlkWWWsOpDQg/

The proposal is approved.

@hiranya911
Copy link
Contributor

That only has the bulk get and delete API as far as I can tell. I don't see getUserByFederatedId() in there.

@@ -605,6 +605,56 @@ protected UserRecord execute() throws FirebaseAuthException {
};
}

/**
* Gets the user data corresponding to the specified user federated identifier.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...the specified user's federated identifier.

(also below)

@rsgowman
Copy link
Member

This is somewhat related to the bulk get, but is slightly different. The API doc for this feature is here: http://doc/1ikY2GoQZrwHNJ5mBa---t2o9R-MdjA4np4uW9SJ9dTg. It isn't approved yet (and thus we can't land this, but we don't want to delay starting on it while waiting for the API approval... especially this time of year.)

@bojeil-google
Copy link
Contributor

Oh I didn't know that. I don't understand why this is being implemented before the other then. Definitely let's hold on this.

@nrsim
Copy link
Contributor Author

nrsim commented Dec 27, 2019

We'll work on the Node implementation then. Sorry, I didn't know starting with the Node implementation was a must. I started with the Java implementation as the Node implementation was going to be tangled with bulk add/delete changes that are sent for review.

@bojeil-google
Copy link
Contributor

Note I won't have time to review this PR. I will only have time to review the Node.js implementation. That should be the case going forward. @rsgowman and @hiranya911 reviews should be sufficient.

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires some unit tests. So far it only has integration tests. See FirebaseUserManagerTest.

} finally {
auth.deleteUserAsync(userRecord.getUid()).get();
auth.deleteUserAsync(randomUser1.uid).get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use bulk delete for this when it becomes available. Add a TODO so we don't forget.

@google-cla
Copy link

google-cla bot commented Mar 16, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@rsgowman rsgowman assigned hiranya911 and unassigned rsgowman and nrsim Mar 16, 2021
Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks pretty solid. Just a few thoughts on cleaning up the tests a bit.

@hiranya911 hiranya911 assigned rsgowman and unassigned hiranya911 Mar 19, 2021
@hiranya911 hiranya911 changed the title Add API to look up users by federated ID. feat(auth): Add API to look up users by federated ID. Mar 19, 2021
@google-cla
Copy link

google-cla bot commented Mar 31, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@rsgowman rsgowman assigned hiranya911 and unassigned rsgowman Mar 31, 2021
Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty solid @rsgowman. Just one more comment concerning the integration tests (Sorry for not bringing that up earlier, but I completely forgot about the TemporaryUser abstraction that we now use in our tests).

auth.deleteUserAsync(randomUser1.getUid()).get();
auth.deleteUserAsync(randomUser2.getUid()).get();
auth.deleteUserAsync(randomUser3.getUid()).get();
if (user1 != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just remembered that we now have a TemporaryUser abstraction that handles automatic clean up of user accounts created during testing. Can we tie createRandomUser() and importRandomUser() methods to that abstraction, and clean up this logic?

Here's an example of how it's being used:

@Test
public void testCustomClaims() throws Exception {
UserRecord userRecord = temporaryUser.create(new UserRecord.CreateRequest());
String uid = userRecord.getUid();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@hiranya911 hiranya911 assigned rsgowman and unassigned hiranya911 Apr 1, 2021
@google-cla
Copy link

google-cla bot commented Apr 9, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@rsgowman rsgowman assigned hiranya911 and unassigned rsgowman Apr 9, 2021
Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Let me know when you want this merged, and I can perform a force merge to override the CLA bot.

@hiranya911 hiranya911 assigned rsgowman and unassigned hiranya911 Apr 19, 2021
@hiranya911 hiranya911 merged commit 589f08b into master Apr 20, 2021
@hiranya911 hiranya911 deleted the lookup-by-federatedid branch April 20, 2021 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants