Skip to content

feat(auth): Added Firebase Auth emulator support#295

Merged
hiranya911 merged 5 commits into
masterfrom
auth-emulator
Apr 13, 2021
Merged

feat(auth): Added Firebase Auth emulator support#295
hiranya911 merged 5 commits into
masterfrom
auth-emulator

Conversation

@hiranya911

@hiranya911 hiranya911 commented Apr 12, 2021

Copy link
Copy Markdown
Contributor

Merging the auth-emulator branch into main. Following Auth APIs now support running against the emulator suite:

  • Custom token creation
  • ID token verification
  • User management (both tenant aware and tenant unaware)
  • Tenant management

RELEASE NOTE: FirebaseAuth and TenantManager APIs now support running against the Firebase emulator suite. Enable the emulator mode by setting the FIREBASE_AUTH_EMULATOR_HOST environment variable to point to the emulator Auth endpoint.

floppydisken and others added 5 commits March 25, 2021 12:56
* Add IdToolkitHostResolver with tests

* Add resolution for versions of the API with tests

* Simplify and reduce IdToolkitHostResolver to a Util method

* Add TestConfig for testing against FirebaseEmulatorHost

Add environment variable test that piggybacks on the already established
FirebaseUserManagerTest.

Also, to make it easier to access and set environment variables a
convenience class has been made to help out. This class utilizes the
neat builtin get and set mechanism provided by the C# language. By using
this class the code somewhat documents itself and prevents stupid
spelling mistakes that might occur when running code. Each environment
variable can conveniently be documented inside the class.

* Add license for new Utils class file

* Add documentation for ResolveIdToolkitHost with examples

* Use the EnvironmentVariable class to access env variables

* Fix formatting

* Use inheritance instead of TestConfig to set FirebaseUserManager tests

The TestConfig was not being disposed of when expected resulting in
the env variable being set in other tests as well and causing them to
fail.

* Cleanup and rename variable to more meaningful name

* Move Utils and EnvironmentVariable class to Auth namespace

* Move emulatorHostEnvVar to where it's used for readability

* Rename UtilTest to more appropriate name

* Rename expected...Host to expected...Url

* Use the FirebaseAuthEmulatorHostName const instead of string

* Add missing license head

* Add missing util import and fix stylecop complaints

* Rename AuthUtil to Util and move to Auth test folder

* Simplify emulator host environment variable to be a constant in Utils

* Use string literal for emulator host in FirebaseUserManagerTest

In case a constant values is changed such as the used environment
variable, this will cause the tests to fail, which is good to know.

* Remove unnecessary tests from FirebaseAuthTest

* Use string literal to ensure test fails if constant is changed

* Remove the environment simplification since there is only one callsite

* Cleanup GetIdToolkitHost documentation

* Correct typo in file name. Util -> Utils.

* Rename test cass to UtilsTest

* Add tenant resolution to GetIdToolkitHost

* Add function for resolving GoogleCredentials when in emulator mode

* Add test for tenant url resolution

* Use if statement instead of ternary for tenantIdPath

* Better formatting for GetIdToolkitHost

* Add periods to the end of documentation strings

* Remove nullable and provide empty string instead

* Change to only have one single line at end

* Add convenience funcs for getting and checking emulator host env variable

* Simplify GetEmulatorHost name
* fix(auth): Setting EmulatorHost programatically

* fix: Cleaned up tests

* fix: Cleaned up user manager tests
* feat(auth): Emulator support for CreateCustomTokenAsync() API

* fix: Cleaned up unit tests

* fix: Removed extra punctuation
* feat(auth): Adding emulator support to TenantManager API

* fix: Updated test to check for credentials
@hiranya911 hiranya911 merged commit 523aa06 into master Apr 13, 2021
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.

3 participants