Skip to content

Commit

Permalink
Display some helpful warnings
Browse files Browse the repository at this point in the history
Otherwise it is too easy for the authentication to fail without it
being clear why.
  • Loading branch information
pgjones committed Dec 2, 2023
1 parent 619c456 commit c54e0d8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/quart_auth/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ async def after_request(self, response: Response) -> Response:
if user.action == Action.WRITE_PERMANENT:
max_age = self.duration

if self.cookie_secure and not request.is_secure:
warnings.warn("Secure cookies will be ignored on insecure requests")

if self.cookie_samesite == "Strict" and 300 <= response.status_code < 400:
warnings.warn("Strict samesite cookies will be ignored on redirects")

token = self.dump_token(user.auth_id)
response.set_cookie(
self.cookie_name,
Expand Down

0 comments on commit c54e0d8

Please sign in to comment.