Skip to content

Commit 08825fa

Browse files
authored
feat: removes default default_max_age from all built-in claims (#607)
1 parent da78c98 commit 08825fa

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
@@ -200,8 +200,6 @@ def reset():
200200

201201
class AllowedDomainsClaimClass(PrimitiveArrayClaim[List[str]]):
202202
def __init__(self):
203-
default_max_age_in_sec = 60 * 60
204-
205203
async def fetch_value(
206204
_user_id: str,
207205
_recipe_user_id: RecipeUserId,
@@ -219,7 +217,7 @@ async def fetch_value(
219217
tenant_id, user_context
220218
)
221219

222-
super().__init__("st-t-dmns", fetch_value, default_max_age_in_sec)
220+
super().__init__("st-t-dmns", fetch_value)
223221

224222

225223
AllowedDomainsClaim = AllowedDomainsClaimClass()

supertokens_python/recipe/userroles/recipe.py

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

264263
async def fetch_value(
265264
user_id: str,
@@ -289,7 +288,7 @@ async def fetch_value(
289288

290289
return list(user_permissions)
291290

292-
super().__init__(key, fetch_value, default_max_age_in_sec)
291+
super().__init__(key, fetch_value)
293292

294293

295294
PermissionClaim = PermissionClaimClass()
@@ -298,7 +297,6 @@ async def fetch_value(
298297
class UserRoleClaimClass(PrimitiveArrayClaim[List[str]]):
299298
def __init__(self) -> None:
300299
key = "st-role"
301-
default_max_age_in_sec = 300
302300

303301
async def fetch_value(
304302
user_id: str,
@@ -313,7 +311,7 @@ async def fetch_value(
313311
)
314312
return res.roles
315313

316-
super().__init__(key, fetch_value, default_max_age_in_sec)
314+
super().__init__(key, fetch_value)
317315

318316

319317
UserRoleClaim = UserRoleClaimClass()

0 commit comments

Comments
 (0)