Improve token verification logic with Auth Emulator.#1148
Merged
Conversation
hiranya911
suggested changes
Jan 28, 2021
Contributor
hiranya911
left a comment
There was a problem hiding this comment.
Thanks @yuchenshi. The implementation looks pretty good. However, we need more work to round off testing. My suggestion is to update the CI setup to invoke the auth integ tests against the emulator as part of our regular builds.
samtstern
approved these changes
Jan 29, 2021
| } else if (payload.iss !== this.issuer + projectId) { | ||
| errorMessage = `${this.tokenInfo.jwtName} has incorrect "iss" (issuer) claim. Expected ` + | ||
| `"${this.issuer}"` + projectId + '" but got "' + | ||
| `"${this.issuer}` + projectId + '" but got "' + |
Contributor
There was a problem hiding this comment.
nit: took me a while staring at this diff because of the mixed use of string templates and string concatenation via +. No need to do anything though, probably not in scope.
hiranya911
approved these changes
Jan 29, 2021
Contributor
hiranya911
left a comment
There was a problem hiding this comment.
LGTM with a suggestion. Also give @bojeil-google a chance to review before merging.
bojeil-google
suggested changes
Feb 3, 2021
bojeil-google
approved these changes
Feb 4, 2021
This was referenced Jun 20, 2024
This was referenced Jul 17, 2024
This was referenced Jul 27, 2024
This was referenced Aug 10, 2024
This was referenced Aug 17, 2024
This was referenced Aug 28, 2024
This was referenced Sep 5, 2024
This was referenced Sep 24, 2024
This was referenced Oct 26, 2024
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Discussion
This PR implements http://go/firebase-auth-emulator-admin-sdk (Google internal design doc). Token verification now works everywhere, not just in functions emulator.
Testing
Ran
node ~/w/firebase-tools/lib/bin/firebase.js emulators:exec --project fake-project-id --only auth 'npx mocha test/integration/auth.spec.ts --slow 5000 --timeout 20000 --require ts-node/register'manually and all tests passed locally (once unrelated pending fixes in the Auth Emulator such as firebase/firebase-tools#3091 and firebase/firebase-tools#3088 are applied).API Changes
(secret API removed; no public API changes)