Skip to content

Commit

Permalink
fastapi_auth_partner: add the option "sliding_session" so session exp…
Browse files Browse the repository at this point in the history
…iration is updated after each call
  • Loading branch information
sebastienbeau committed Jun 27, 2024
1 parent cb9fc28 commit 3384623
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fastapi_auth_partner/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions fastapi_auth_partner/models/fastapi_auth_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions fastapi_auth_partner/views/fastapi_auth_directory_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<field name="invite_validate_email_template_id" />
<field name="cookie_secret_key" />
<field name="cookie_duration" />
<field name="sliding_session" />
<field name="set_password_token_duration" />
</group>
<group
Expand Down

0 comments on commit 3384623

Please sign in to comment.