Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add freshness to auth tokens #990

Merged
merged 1 commit into from
Jun 15, 2024
Merged

Add freshness to auth tokens #990

merged 1 commit into from
Jun 15, 2024

Conversation

jwag956
Copy link
Collaborator

@jwag956 jwag956 commented Jun 15, 2024

This enables us-setup to be totally functional with auth tokens (not requiring a session cookie).

  • Authentication tokens now carry freshness information - namely the timestamp that the client/user successfully authenticated.
  • Both sessions and auth tokens place the timestamp into a request global - fs_paa
  • @auth_required() freshness checking looks at the request global - a config parameter SECURITY_FRESHNESS_ALLOW_AUTH_TOKEN can be set to False which forces any request using an auth token to be 'not-fresh' (the previous behavior).
  • Removed code for freshness 'within' == 0 - which was a hack for testing - we have better testing utilities now.
  • fixed/improved example for unified signin.
  • doc improvements...

Copy link

codecov bot commented Jun 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.44%. Comparing base (80a7139) to head (c44d6a2).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #990   +/-   ##
=======================================
  Coverage   98.44%   98.44%           
=======================================
  Files          36       36           
  Lines        4621     4622    +1     
=======================================
+ Hits         4549     4550    +1     
  Misses         72       72           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This enables us-setup to be totally functional with auth tokens (not requiring a session cookie).

- Authentication tokens now carry freshness information - namely the timestamp that the client/user successfully authenticated.
- Both sessions and auth tokens place the timestamp into a request global - fs_paa
- @auth_required() freshness checking looks at the request global - a config parameter SECURITY_FRESHNESS_ALLOW_AUTH_TOKEN can be set to False which forces any request using an auth token to be 'not-fresh' (the previous behavior).
- Removed code for freshness 'within' == 0 - which was a hack for testing - we have better testing utilities now.
- fixed/improved example for unified signin.
- doc improvements...
@jwag956 jwag956 merged commit 4c33560 into master Jun 15, 2024
19 checks passed
@jwag956 jwag956 deleted the sessionid branch June 15, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant