Commit 523aa06
feat(auth): Added Firebase Auth emulator support (#295)
* feat(auth): Add support for Firebase Authentication Emulator (#289)
* 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 (#290)
* fix(auth): Setting EmulatorHost programatically
* fix: Cleaned up tests
* fix: Cleaned up user manager tests
* feat(auth): Supporting VerifyIdToken() API with emulator (#291)
* feat(auth): Emulator support for CreateCustomTokenAsync() API (#293)
* feat(auth): Emulator support for CreateCustomTokenAsync() API
* fix: Cleaned up unit tests
* fix: Removed extra punctuation
* feat(auth): Adding emulator support to TenantManager API (#294)
* feat(auth): Adding emulator support to TenantManager API
* fix: Updated test to check for credentials
Co-authored-by: Bjarke <[email protected]>1 parent f6babbd commit 523aa06
File tree
24 files changed
+921
-360
lines changed- FirebaseAdmin
- FirebaseAdmin.Tests/Auth
- Jwt
- Multitenancy
- Users
- FirebaseAdmin/Auth
- Jwt
- Multitenancy
- Users
24 files changed
+921
-360
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| |||
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
| |||
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
| 111 | + | |
102 | 112 | | |
103 | 113 | | |
104 | 114 | | |
| |||
107 | 117 | | |
108 | 118 | | |
109 | 119 | | |
110 | | - | |
| 120 | + | |
111 | 121 | | |
112 | 122 | | |
113 | 123 | | |
| |||
117 | 127 | | |
118 | 128 | | |
119 | 129 | | |
120 | | - | |
121 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
122 | 137 | | |
123 | 138 | | |
124 | 139 | | |
125 | 140 | | |
126 | 141 | | |
127 | 142 | | |
128 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
129 | 156 | | |
130 | 157 | | |
Lines changed: 72 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
Lines changed: 63 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
87 | 104 | | |
88 | 105 | | |
89 | 106 | | |
| |||
123 | 140 | | |
124 | 141 | | |
125 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
126 | 157 | | |
127 | 158 | | |
128 | 159 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
134 | 166 | | |
135 | 167 | | |
136 | 168 | | |
137 | 169 | | |
138 | 170 | | |
139 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
140 | 194 | | |
141 | 195 | | |
142 | 196 | | |
| |||
Lines changed: 52 additions & 62 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 71 | + | |
92 | 72 | | |
93 | | - | |
94 | | - | |
| 73 | + | |
| 74 | + | |
95 | 75 | | |
96 | | - | |
97 | | - | |
98 | | - | |
| 76 | + | |
99 | 77 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
104 | 81 | | |
105 | | - | |
| 82 | + | |
106 | 83 | | |
107 | | - | |
108 | | - | |
| 84 | + | |
109 | 85 | | |
110 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
111 | 93 | | |
112 | | - | |
113 | 94 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 95 | + | |
123 | 96 | | |
124 | | - | |
125 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
126 | 105 | | |
127 | | - | |
128 | 106 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
133 | 117 | | |
134 | | - | |
135 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
136 | 126 | | |
137 | | - | |
| 127 | + | |
| 128 | + | |
138 | 129 | | |
139 | | - | |
140 | | - | |
| 130 | + | |
141 | 131 | | |
142 | 132 | | |
143 | 133 | | |
| |||
0 commit comments