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

core: add user settable token durations #7410

Merged
merged 28 commits into from
Apr 11, 2024
Merged

Conversation

jmdilly
Copy link
Contributor

@jmdilly jmdilly commented Nov 2, 2023

Details

This PR enables users to specify a non default lifetime for users created app application token. By the way, it enforces expires value on API side.

Closes #5881

Current limitation : maximum duration is currently not enforce in the UI but only on API side. This is because I haven't find yet an easy way to provide that piece of information to the UI without add a new API endpoint which would require additionnal work. Nevertheless, if the chosen expiration date is invalid, an error message is still thrown up to the use explaining why it has failed.
In my opinion, this enforcement within the UI could be enforced in a future improvement.


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • [] The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)
  • The translation files have been updated (make i18n-extract)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@jmdilly jmdilly requested review from a team as code owners November 2, 2023 02:15
Copy link

netlify bot commented Nov 2, 2023

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 12736d0
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/6616ab95f08f34000880de1f
😎 Deploy Preview https://deploy-preview-7410--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Nov 2, 2023

Codecov Report

Attention: Patch coverage is 31.03448% with 60 lines in your changes are missing coverage. Please review.

Project coverage is 45.89%. Comparing base (633028c) to head (12736d0).

Files Patch % Lines
authentik/core/tests/test_token_api.py 0.00% 42 Missing ⚠️
authentik/core/api/tokens.py 13.33% 13 Missing ⚠️
authentik/core/models.py 75.00% 4 Missing ⚠️
authentik/core/signals.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #7410       +/-   ##
===========================================
- Coverage   92.40%   45.89%   -46.51%     
===========================================
  Files         646      646               
  Lines       31851    31926       +75     
===========================================
- Hits        29431    14654    -14777     
- Misses       2420    17272    +14852     
Flag Coverage Δ
e2e 44.38% <31.03%> (-6.13%) ⬇️
integration 26.33% <27.58%> (-0.02%) ⬇️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

netlify bot commented Nov 2, 2023

Deploy Preview for authentik ready!

Name Link
🔨 Latest commit f81a028
🔍 Latest deploy log https://app.netlify.com/sites/authentik/deploys/65d460ef4a652d0008156d77
😎 Deploy Preview https://deploy-preview-7410--authentik.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@tanberry tanberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny edits, thanks for remembering to add docs!

website/docs/user-group-role/user/user_ref.md Outdated Show resolved Hide resolved
authentik/core/models.py Outdated Show resolved Hide resolved
@BeryJu BeryJu self-assigned this Dec 28, 2023
@BeryJu BeryJu added the status/reviewing thanks for opening, we're taking a look label Dec 28, 2023
Comment on lines +77 to +79
raise ValidationError(
{"expires": f"Token expires exceeds maximum lifetime ({max_token_lifetime})."}
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we instead set the token expiration to something like min(attrs.get("expires"), token_expires_from_timedelta(max_token_lifetime_dt))?

jmdilly and others added 10 commits January 26, 2024 15:52
Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: Jean-Michel DILLY <48059109+jmdilly@users.noreply.github.com>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
@rissson rissson self-assigned this Feb 20, 2024
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Copy link

netlify bot commented Feb 26, 2024

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 12736d0
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/6616ab94e761610008caa6fd
😎 Deploy Preview https://deploy-preview-7410--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
authentik/core/models.py Outdated Show resolved Hide resolved
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
@BeryJu BeryJu merged commit a70363b into goauthentik:main Apr 11, 2024
57 of 65 checks passed
kensternberg-authentik added a commit that referenced this pull request Apr 12, 2024
* main:
  website/docs: add more info and links about enforciing unique email addresses (#9154)
  core: bump goauthentik.io/api/v3 from 3.2024022.7 to 3.2024022.8 (#9215)
  web: bump API Client version (#9214)
  stages/authenticator_validate: add ability to limit webauthn device types (#9180)
  web: bump API Client version (#9213)
  core: add user settable token durations (#7410)
  core, web: update translations (#9205)
  web: bump typescript from 5.4.4 to 5.4.5 in /tests/wdio (#9206)
  web: bump chromedriver from 123.0.2 to 123.0.3 in /tests/wdio (#9207)
  core: bump sentry-sdk from 1.44.1 to 1.45.0 (#9208)
  web: bump typescript from 5.4.4 to 5.4.5 in /web (#9209)
  website: bump typescript from 5.4.4 to 5.4.5 in /website (#9210)
  core: bump python from 3.12.2-slim-bookworm to 3.12.3-slim-bookworm (#9211)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/reviewing thanks for opening, we're taking a look
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow end users to create app passwords with longer (or no) expiry
4 participants