Skip to content

fix: Add tenant id in global claim validators #399

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

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions supertokens_python/recipe/session/asyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ async def validate_claims_for_session_handle(
global_claim_validators = await resolve(
recipe_impl.get_global_claim_validators(
session_info.user_id,
session_info.tenant_id,
claim_validators_added_by_other_recipes,
user_context,
)
Expand Down Expand Up @@ -188,6 +189,7 @@ async def validate_claims_for_session_handle(

async def validate_claims_in_jwt_payload(
user_id: str,
tenant_id: str,
jwt_payload: JSONObject,
override_global_claim_validators: Optional[
Callable[
Expand All @@ -212,6 +214,7 @@ async def validate_claims_in_jwt_payload(
global_claim_validators = await resolve(
recipe_impl.get_global_claim_validators(
user_id,
tenant_id,
claim_validators_added_by_other_recipes,
user_context,
)
Expand Down
1 change: 1 addition & 0 deletions supertokens_python/recipe/session/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ async def create_new_session(
def get_global_claim_validators(
self,
user_id: str,
tenant_id: str,
claim_validators_added_by_other_recipes: List[SessionClaimValidator],
user_context: Dict[str, Any],
) -> MaybeAwaitable[List[SessionClaimValidator]]:
Expand Down
1 change: 1 addition & 0 deletions supertokens_python/recipe/session/recipe_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ async def get_claim_value(
def get_global_claim_validators(
self,
user_id: str,
tenant_id: str,
claim_validators_added_by_other_recipes: List[SessionClaimValidator],
user_context: Dict[str, Any],
) -> MaybeAwaitable[List[SessionClaimValidator]]:
Expand Down
7 changes: 6 additions & 1 deletion supertokens_python/recipe/session/syncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ def validate_claims_for_session_handle(

def validate_claims_in_jwt_payload(
user_id: str,
tenant_id: str,
jwt_payload: JSONObject,
override_global_claim_validators: Optional[
Callable[
Expand All @@ -401,6 +402,10 @@ def validate_claims_in_jwt_payload(

return sync(
async_validate_claims_in_jwt_payload(
user_id, jwt_payload, override_global_claim_validators, user_context
user_id,
tenant_id,
jwt_payload,
override_global_claim_validators,
user_context,
)
)
1 change: 1 addition & 0 deletions supertokens_python/recipe/session/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ async def get_required_claim_validators(
global_claim_validators = await resolve(
SessionRecipe.get_instance().recipe_implementation.get_global_claim_validators(
session.get_user_id(),
session.get_tenant_id(),
claim_validators_added_by_other_recipes,
user_context,
)
Expand Down
2 changes: 2 additions & 0 deletions tests/sessions/claims/test_verify_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def st_init_generator_with_overriden_global_validators(
def session_function_override(oi: RecipeInterface) -> RecipeInterface:
async def new_get_global_claim_validators(
_user_id: str,
_tenant_id: str,
_claim_validators_added_by_other_recipes: List[SessionClaimValidator],
_user_context: Dict[str, Any],
):
Expand All @@ -73,6 +74,7 @@ def st_init_generator_with_claim_validator(claim_validator: SessionClaimValidato
def session_function_override(oi: RecipeInterface) -> RecipeInterface:
async def new_get_global_claim_validators(
_user_id: str,
_tenant_id: str,
claim_validators_added_by_other_recipes: List[SessionClaimValidator],
_user_context: Dict[str, Any],
):
Expand Down