diff --git a/fastapi_auth_partner/dependencies.py b/fastapi_auth_partner/dependencies.py index 8fe43da9..8770412a 100644 --- a/fastapi_auth_partner/dependencies.py +++ b/fastapi_auth_partner/dependencies.py @@ -62,6 +62,8 @@ def __call__( lambda s: s.directory_id == directory ) if auth: + if directory.sliding_session: + auth._set_auth_cookie(response) return partner _logger.info("Could not determine partner from 'fastapi_auth_partner' cookie.") raise HTTPException(status_code=HTTP_401_UNAUTHORIZED) diff --git a/fastapi_auth_partner/models/fastapi_auth_directory.py b/fastapi_auth_partner/models/fastapi_auth_directory.py index 434c778c..e0dc7409 100644 --- a/fastapi_auth_partner/models/fastapi_auth_directory.py +++ b/fastapi_auth_partner/models/fastapi_auth_directory.py @@ -72,6 +72,7 @@ class FastApiAuthDirectory(models.Model): ).ids, groups="fastapi_auth_partner.group_partner_auth_manager", ) + sliding_session = fields.Boolean() def _compute_count_partner(self): data = self.env["fastapi.auth.partner"].read_group( diff --git a/fastapi_auth_partner/views/fastapi_auth_directory_view.xml b/fastapi_auth_partner/views/fastapi_auth_directory_view.xml index 5ec09057..82f8460e 100644 --- a/fastapi_auth_partner/views/fastapi_auth_directory_view.xml +++ b/fastapi_auth_partner/views/fastapi_auth_directory_view.xml @@ -41,6 +41,7 @@ +