Skip to content

Commit 55847f8

Browse files
committed
feat: removes default default_max_age from all built-in claims
1 parent 206d50e commit 55847f8

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [unreleased]
1010

11-
## [0.31.0] - 2025-07-18
11+
## [0.31.0] - 2025-08-21
1212
### Adds plugins support
1313
- Adds an `experimental` property (`SuperTokensExperimentalConfig`) to the `SuperTokensConfig`
1414
- Plugins can be configured under using the `plugins` property in the `experimental` config
1515
- Refactors the AccountLinking recipe to be automatically initialized on SuperTokens init
1616
- Adds `is_recipe_initialized` method to check if a recipe has been initialized
1717

1818
### Breaking Changes
19+
- Removed default `default_max_age` from all built-in claims/validators.
20+
- You can optionally set them when adding the validators.
21+
- This should help with unexpected API calls during session verification.
1922
- `AccountLinkingRecipe.get_instance` will now raise an exception if not initialized
2023
- Various config classes renamed for consistency across the codebase, and classes added where they were missing
2124
- Old classes added to the recipe modules as aliases for backward compatibility, but will be removed in future versions. Prefer using the renamed classes.

supertokens_python/recipe/multitenancy/recipe.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ def reset():
201201

202202
class AllowedDomainsClaimClass(PrimitiveArrayClaim[List[str]]):
203203
def __init__(self):
204-
default_max_age_in_sec = 60 * 60
205-
206204
async def fetch_value(
207205
_user_id: str,
208206
_recipe_user_id: RecipeUserId,
@@ -220,7 +218,7 @@ async def fetch_value(
220218
tenant_id, user_context
221219
)
222220

223-
super().__init__("st-t-dmns", fetch_value, default_max_age_in_sec)
221+
super().__init__("st-t-dmns", fetch_value)
224222

225223

226224
AllowedDomainsClaim = AllowedDomainsClaimClass()

supertokens_python/recipe/userroles/recipe.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ def get_instance() -> UserRolesRecipe:
260260
class PermissionClaimClass(PrimitiveArrayClaim[List[str]]):
261261
def __init__(self) -> None:
262262
key = "st-perm"
263-
default_max_age_in_sec = 300
264263

265264
async def fetch_value(
266265
user_id: str,
@@ -290,7 +289,7 @@ async def fetch_value(
290289

291290
return list(user_permissions)
292291

293-
super().__init__(key, fetch_value, default_max_age_in_sec)
292+
super().__init__(key, fetch_value)
294293

295294

296295
PermissionClaim = PermissionClaimClass()
@@ -299,7 +298,6 @@ async def fetch_value(
299298
class UserRoleClaimClass(PrimitiveArrayClaim[List[str]]):
300299
def __init__(self) -> None:
301300
key = "st-role"
302-
default_max_age_in_sec = 300
303301

304302
async def fetch_value(
305303
user_id: str,
@@ -314,7 +312,7 @@ async def fetch_value(
314312
)
315313
return res.roles
316314

317-
super().__init__(key, fetch_value, default_max_age_in_sec)
315+
super().__init__(key, fetch_value)
318316

319317

320318
UserRoleClaim = UserRoleClaimClass()

0 commit comments

Comments
 (0)