-
Notifications
You must be signed in to change notification settings - Fork 80
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
Improved OAuth2l Client Interface #70
Conversation
-Uses advanced go-flags library to parse command-line flags, which improves organization, flexibility, and better built-in help doc. -Added explicit flags for GUAC arguments such as scope and audience. -Added support for a new "curl" command. -Fixed variadic bug in sso.go that incorrectly handles multiple scopes.
Also removed short (single character) flags to improve clarity and avoid misuse.
-"url" is now an explicit required flag for "curl" command. -introduced command-specific options for "fetch", "header", and "curl" to improve context-aware help messages and enforce required parameters. -Updated documentation.
-Added helper methods to main.go -Added support for space-delimited scope -Updated README.md
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.
Thanks for the update! Just a few more minor comments.
README.md
Outdated
@@ -7,7 +7,24 @@ working with | |||
written in Go. Its primary use is to fetch and print OAuth 2.0 access | |||
tokens, which can be used with other command-line tools and shell scripts. | |||
|
|||
## Previous Version | |||
## July 2019 Update |
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.
Let's not add this here, we can create a new release after this one and add this to the release log.
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.
Ok. Let's create a proper tagged release after this change. Reverting this part of the read me for now.
) | ||
|
||
// Executes curl command with provided header and params. | ||
func CurlCommand(cli string, header string, url string, extraArgs ...string) { |
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.
Can we change this to just take the token so we don't have to use BuildHeader every time before invoking this?
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 think it's better to have "header" as the parameter here for several reasons:
- The logic to construct the authorization header from "token type" and "access token" has nothing to with the curl command itself, which is generic. The curl util is more flexible in its current form.
- The SSO path does not give us a "token object" to work with, and uses BuildHeader differently. It is cleaner to pass the final "header" into the CurlCommand function.
-Will put updates into release notes for official release. -Minor formatting changes
LGTM |
-Enhanced command-line flag parsing via "go-flags" library. This improves code readability and provides context-aware help messages. Also provides enforcement of required flags, and rejects incompatible flags.
-Added explicit flags for GUAC arguments such as "scope" and "audience". Maintains backward compatibility with implicit flags and deprecated flags.
-Added support for a new "curl" command, which is a short-cut for making a curl request with a fetched token.
-Updated documentation.