-
Notifications
You must be signed in to change notification settings - Fork 663
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(cli): add auth command (#11004) #12885
Conversation
Adds `coder auth` command with 3 sub-commands: `coder auth token`, `coder auth status` and `coder auth login`. `coder auth login`: This is the same command as `coder login`. `coder auth status`: Informs the user about their authentication status. It may make sense for this to not show an error if called when user is not logged in. `coder auth token`: Informs the user of their token string and the expiration time of the token. All the commands use a middleware to check that the user is authenticated and will return an error if the user is not. They also make at most 2 API calls. The commands have additional values that could be shown but are not with this implementation.
c9b64f5
to
f554cd2
Compare
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.
I noticed when the user provides --token
or the env, this might lead to some confusion as to where auth status originates from. It might be good to show "source" here, i.e. either it's from config, env or flag.
Hi @elasticspoon could you address review suggestions so the PR doesn't stale and close. Thank you for the contribution. :) |
Change language in commands Humanize session token remaining time Inline auth middleware
Fixes #11004 (partially)
Creates the command
coder auth
for authentication purposes.coder auth
has 3 sub-commandslogin
,status
andtoken
. Currently the sub-commands make 2 requests to the server: validation of the user and an additional command for sub-command info (token info, etc.)coder auth status
andcoder auth token
commands return an error if the user is not authenticated when they are called.coder auth
Just returns the help message.
coder auth login
This is the same command as
coder login
.coder auth status
Informs the user about their authentication status. It may make sense for this to not show an error if called when user is not logged in.
Additional info that is available from the current requests and could be shown:
coder auth token
Informs the user of their token string and the expiration time of the token. (Maybe
coder auth session
is a better name or alias?)Additional info that is available from the current requests and could be shown: