-
Notifications
You must be signed in to change notification settings - Fork 285
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
Conversation
In general we don't add APIs to this SDK that are not already present in the Node.js SDK. @bojeil-google WDYT? |
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). |
Sounds good. I'll assign to @rsgowman for now. Do we have an API proposal for this? |
Yeah, link is at: https://docs.google.com/document/d/1OfN5XH6cYJ7y3AnNsocftQSrbMiMaLlPlkWWWsOpDQg/ The proposal is approved. |
That only has the bulk get and delete API as far as I can tell. I don't see |
@@ -605,6 +605,56 @@ protected UserRecord execute() throws FirebaseAuthException { | |||
}; | |||
} | |||
|
|||
/** | |||
* Gets the user data corresponding to the specified user federated identifier. |
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.
...the specified user's federated identifier.
(also below)
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.) |
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. |
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. |
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. |
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.
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(); |
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.
We should use bulk delete for this when it becomes available. Add a TODO so we don't forget.
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 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 ℹ️ Googlers: Go here for more info. |
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.
Implementation looks pretty solid. Just a few thoughts on cleaning up the tests a bit.
src/main/java/com/google/firebase/auth/AbstractFirebaseAuth.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/firebase/auth/FirebaseUserManager.java
Outdated
Show resolved
Hide resolved
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 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 ℹ️ Googlers: Go here for more info. |
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.
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) { |
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.
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:
firebase-admin-java/src/test/java/com/google/firebase/auth/FirebaseAuthIT.java
Lines 446 to 449 in d8b1583
@Test | |
public void testCustomClaims() throws Exception { | |
UserRecord userRecord = temporaryUser.create(new UserRecord.CreateRequest()); | |
String uid = userRecord.getUid(); |
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.
Done.
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 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 ℹ️ Googlers: Go here for more info. |
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.
LGTM 👍
Let me know when you want this merged, and I can perform a force merge to override the CLA bot.
RELEASE NOTE: Added a new
getUserByProviderUid()
method to lookup user accounts by their providers