-
Notifications
You must be signed in to change notification settings - Fork 133
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
feat(auth): Add support for Firebase Authentication Emulator #289
Merged
hiranya911
merged 36 commits into
firebase:auth-emulator
from
floppydisken:add-emulator-support
Mar 25, 2021
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
03d9f5a
Add IdToolkitHostResolver with tests
floppydisken 92ea12d
Add resolution for versions of the API with tests
floppydisken 5e22928
Simplify and reduce IdToolkitHostResolver to a Util method
floppydisken f957a2b
Add TestConfig for testing against FirebaseEmulatorHost
floppydisken 5fa8bc3
Add license for new Utils class file
floppydisken 98a979e
Add documentation for ResolveIdToolkitHost with examples
floppydisken 829f62d
Use the EnvironmentVariable class to access env variables
floppydisken e2b70f6
Fix formatting
floppydisken 3a06064
Use inheritance instead of TestConfig to set FirebaseUserManager tests
floppydisken 19c386a
Cleanup and rename variable to more meaningful name
floppydisken 85ee525
Move Utils and EnvironmentVariable class to Auth namespace
floppydisken 23e064f
Move emulatorHostEnvVar to where it's used for readability
floppydisken 98948fb
Rename UtilTest to more appropriate name
floppydisken 099a1d8
Rename expected...Host to expected...Url
floppydisken a78f018
Use the FirebaseAuthEmulatorHostName const instead of string
floppydisken 1f701d8
Add missing license head
floppydisken c7cbd41
Add missing util import and fix stylecop complaints
floppydisken 002d368
Rename AuthUtil to Util and move to Auth test folder
floppydisken bddaafc
Simplify emulator host environment variable to be a constant in Utils
floppydisken afee451
Use string literal for emulator host in FirebaseUserManagerTest
floppydisken 1e3fe6b
Remove unnecessary tests from FirebaseAuthTest
floppydisken 52c7b9e
Use string literal to ensure test fails if constant is changed
floppydisken 248f5e7
Remove the environment simplification since there is only one callsite
floppydisken 778d3c1
Cleanup GetIdToolkitHost documentation
floppydisken 6f3cf7e
Correct typo in file name. Util -> Utils.
floppydisken 76d4aa2
Rename test cass to UtilsTest
floppydisken c190edc
Add tenant resolution to GetIdToolkitHost
floppydisken 31ec063
Add function for resolving GoogleCredentials when in emulator mode
floppydisken b18be18
Add test for tenant url resolution
floppydisken f9c6cae
Use if statement instead of ternary for tenantIdPath
floppydisken 4c62390
Better formatting for GetIdToolkitHost
floppydisken 359dc7c
Add periods to the end of documentation strings
floppydisken a80cca4
Remove nullable and provide empty string instead
floppydisken 590ffa6
Change to only have one single line at end
floppydisken 855aac4
Add convenience funcs for getting and checking emulator host env vari…
floppydisken 1595d36
Simplify GetEmulatorHost name
floppydisken 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
Fix formatting
- Loading branch information
commit e2b70f6ce34ca2d3351b9c83ce509e1f4e8a117a
There are no files selected for viewing
This file contains 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 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.
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 is a pretty neat trick, and I do appreciate the power it brings. It basically puts an env variable lookup behind a typesafe constraint that can be checked by the compiler.
However, this is a bit too exposed right now. So:
Utils
class (and remove this class entirely), so it's scoped to the Auth namespace, andThere 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 was actually thinking the class to also provide access to the "GOOGLE_CLOUD_HOST" and "GCLOUD_HOST" environment variables as well as other variables. I am quite unaware of the amount of env variables used for the Firebase client libraries, so I don't know if it's a good idea. However, it would make sense that this particular environment variable is scoped to the Auth namespace.
Removing the class itself, would result in naming like
FirebaseAuthHostEnvironmentVariable
instead ofEnvironmentVariable.FirebaseAuthHost
, which I see no advantage to. Am I misunderstanding you perhaps?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.
Proposed change in 85ee525
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.
My reasoning is that this class will end up being a wrapper for a single constant. Therefore it's just simpler to use the
Utils
class itself as the wrapper, and rename the constant to something likeEmulatorHostEnvironmentVar
.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.
#289 (comment)