|
12 | 12 | # License for the specific language governing permissions and limitations
|
13 | 13 | # under the License.
|
14 | 14 | from __future__ import annotations
|
15 |
| -import importlib |
16 |
| - |
17 | 15 | from typing import TYPE_CHECKING, List, Optional, Union, Dict, Any
|
| 16 | +from supertokens_python.recipe.multitenancy.asyncio import get_tenant |
| 17 | +from supertokens_python.recipe.multitenancy.recipe import MultitenancyRecipe |
18 | 18 | from supertokens_python.recipe.session import SessionContainer
|
19 | 19 | from supertokens_python.recipe.session.asyncio import get_session_information
|
20 | 20 | from supertokens_python.recipe.session.exceptions import UnauthorisedError
|
|
35 | 35 | from supertokens_python.recipe.multifactorauth.multi_factor_auth_claim import (
|
36 | 36 | MultiFactorAuthClaimClass,
|
37 | 37 | )
|
38 |
| - from supertokens_python.recipe.multitenancy.recipe import ( |
39 |
| - MultitenancyRecipe as MTRecipeType, |
40 |
| - ) |
41 | 38 |
|
42 | 39 |
|
43 | 40 | def validate_and_normalise_user_input(
|
@@ -203,16 +200,7 @@ async def user_getter():
|
203 | 200 | async def get_required_secondary_factors_for_tenant(
|
204 | 201 | tenant_id: str, user_context: Dict[str, Any]
|
205 | 202 | ) -> List[str]:
|
206 |
| - |
207 |
| - MultitenancyRecipe = importlib.import_module( |
208 |
| - "supertokens_python.recipe.multitenancy.recipe" |
209 |
| - ) |
210 |
| - |
211 |
| - mt_recipe: MTRecipeType = MultitenancyRecipe.get_instance() |
212 |
| - |
213 |
| - tenant_info = await mt_recipe.recipe_implementation.get_tenant( |
214 |
| - tenant_id=tenant_id, user_context=user_context |
215 |
| - ) |
| 203 | + tenant_info = await get_tenant(tenant_id, user_context) |
216 | 204 | if tenant_info is None:
|
217 | 205 | raise UnauthorisedError("Tenant not found")
|
218 | 206 | return (
|
@@ -276,14 +264,8 @@ async def is_valid_first_factor(
|
276 | 264 | tenant_id: str, factor_id: str, user_context: Dict[str, Any]
|
277 | 265 | ) -> Literal["OK", "INVALID_FIRST_FACTOR_ERROR", "TENANT_NOT_FOUND_ERROR"]:
|
278 | 266 |
|
279 |
| - MultitenancyRecipe = importlib.import_module( |
280 |
| - "supertokens_python.recipe.multitenancy.recipe" |
281 |
| - ) |
282 |
| - |
283 |
| - mt_recipe: MTRecipeType = MultitenancyRecipe.get_instance() |
284 |
| - tenant_info = await mt_recipe.recipe_implementation.get_tenant( |
285 |
| - tenant_id=tenant_id, user_context=user_context |
286 |
| - ) |
| 267 | + mt_recipe = MultitenancyRecipe.get_instance() |
| 268 | + tenant_info = await get_tenant(tenant_id=tenant_id, user_context=user_context) |
287 | 269 | if tenant_info is None:
|
288 | 270 | return "TENANT_NOT_FOUND_ERROR"
|
289 | 271 |
|
|
0 commit comments