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

Improved OAuth2l Client Interface #70

Merged
merged 9 commits into from
Aug 5, 2019
Merged

Conversation

andyrzhao
Copy link
Collaborator

-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.

andyrzhao added 6 commits July 3, 2019 13:29
-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.
@shinfan shinfan requested review from shinfan and wora July 12, 2019 18:08
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
-Added helper methods to main.go
-Added support for space-delimited scope
-Updated README.md
Copy link
Collaborator

@shinfan shinfan left a 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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
util/tasks.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
util/curl.go Outdated Show resolved Hide resolved
util/curl.go Outdated Show resolved Hide resolved
)

// Executes curl command with provided header and params.
func CurlCommand(cli string, header string, url string, extraArgs ...string) {
Copy link
Collaborator

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?

Copy link
Collaborator Author

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:

  1. 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.
  2. 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
@shinfan
Copy link
Collaborator

shinfan commented Aug 5, 2019

LGTM
Note: The Travis failure is due to the tool infra issue and not related to this PR.

@shinfan shinfan merged commit 717448a into google:master Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants