-
Notifications
You must be signed in to change notification settings - Fork 359
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
feat: add master configurations for access token max and default lifespans [DET-10464] #10101
Changes from 5 commits
79b0d0a
89e7994
aa08958
16de5ec
4c6a7c5
719cfab
2a424e3
0076fca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,8 +85,11 @@ def create_token(args: argparse.Namespace) -> None: | |
raise errors.CliError(f"User '{username}' not found or does not have an ID") | ||
|
||
# convert days into hours Go duration format | ||
if args.expiration_days: | ||
expiration_in_hours = str(24 * args.expiration_days) + "h" | ||
expiration_in_hours = None | ||
if args.expiration_days is not None: | ||
expiration_in_hours = ( | ||
"-1" if args.expiration_days == -1 else f"{24 * args.expiration_days}h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be worth just making sure that args.expiration_days is an int here, if it's a float not sure what would happen There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the current code, any float input would return an error Another option is to explicitly cast the input to an integer. However, the potential issue with this approach is that it could mislead users into thinking that floating-point values are valid, which might give the impression that fractional days are allowed.
|
||
) | ||
|
||
request = bindings.v1PostAccessTokenRequest( | ||
userId=user.id, lifespan=expiration_in_hours, description=args.description | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reading this it is not clear to me the difference between an "access token" and a regular token, and i'm not sure how a user would know there is a difference, but I dont have an immediate idea of how to fix it.