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

added an option to NewHCPConfig() to not auto login when no local aut… #182

Merged
merged 19 commits into from
Apr 18, 2023

Conversation

lursu
Copy link
Contributor

@lursu lursu commented Apr 6, 2023

…h method are found

🛠️ Description

🔗 External Links

👍 Definition of Done

  • SDK added
  • SDK updated
  • Tests added?
  • Docs updated?

@lursu lursu requested review from itsjaspermilan, bcmdarroch and a team April 6, 2023 19:18
Copy link
Contributor

@bcmdarroch bcmdarroch left a comment

Choose a reason for hiding this comment

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

My main suggestion here is to move the logic entirely into the config package. My review is spread over a few comments, but to sum it up in one place:

  1. Instead of adding a noBrowserLogin flag to the config, we can "turn off" the existing oauth2Config field.
  2. In the config package, an empty oauth2Config can be detected and result in a NoValidAuthFound.

config/hcp.go Show resolved Hide resolved
config/with.go Show resolved Hide resolved
config/new.go Show resolved Hide resolved
auth/user.go Outdated
"fmt"
"log"
"time"

"golang.org/x/oauth2"
)

var (
// ErrorNoValidAuthFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin
ErrorNoValidAuthFound = errors.New("there were no valid auth methods found")
Copy link
Contributor

Choose a reason for hiding this comment

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

I would move this up into the config package.

lursu and others added 2 commits April 12, 2023 08:59
Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com>
config/hcp.go Outdated Show resolved Hide resolved
lursu and others added 2 commits April 12, 2023 11:10
Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com>
Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com>
Copy link
Contributor

@bcmdarroch bcmdarroch 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 address my feedback! With a couple minor fixes, it's good to go!

Copy link
Contributor

@jesdavpet jesdavpet left a comment

Choose a reason for hiding this comment

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

⚠️ I didn't read the diff before approving ... ⚠️

This is just a rubber stamp approval to +1 @bcmdarroch's review until we can remove @hashicorp/experiences-platform from this repo's CODEOWNERS file.

@lursu lursu requested a review from a team as a code owner April 17, 2023 13:12
@lursu lursu requested review from a team, codergs and himran92 April 17, 2023 13:12
auth/user.go Outdated Show resolved Hide resolved
config/hcp.go Outdated Show resolved Hide resolved
config/new.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
auth/user.go Outdated Show resolved Hide resolved
lursu and others added 5 commits April 18, 2023 08:59
Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com>
Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com>
Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com>
Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com>
@lursu lursu merged commit 7774b99 into main Apr 18, 2023
@lursu lursu deleted the VAULT-14185/add_option_to_fail_on_no_valid_login branch April 18, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants