-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Keyring v2 #7033
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
Keyring v2 #7033
Conversation
cd185b1 to
5488d0b
Compare
| // TODO this probably shouldn't live in this package. It should probably be in a new package that | ||
| // depends on both iostreams and config. | ||
|
|
||
| // FIXME: this duplicates `factory.browserLauncher()` |
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.
Addressed both of these as part of the refactor by having the AuthFlow take a browser.Browser as an input and moving the writing of the config out of this flow and having the caller be responsible for writing it.
| // This is deprecated and will be removed, do not use! | ||
| // Please use cfg.Authentication().Token() | ||
| AuthToken(string) (string, string) | ||
| // This is deprecated and will be removed, do not use! | ||
| // Please use cfg.Authentication().DefaultHost() | ||
| DefaultHost() (string, 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.
Would have removed these but it would have ballooned the size of this PR. Will do it in a follow up cleanup PR.
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.
| hostsOverride func() []string | ||
| tokenOverride func(string) (string, 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.
I tried a new approach here to have the overrides live inside the struct rather than create an interface that can be mocked out. Any function that calls a ghAuth can have an override.
| // Login will set user, git protocol, and auth token for the given hostname. | ||
| // If the encrypt option is specified it will first try to store the auth token | ||
| // in encrypted storage and will fall back to the plain text config file. | ||
| func (c *AuthConfig) Login(hostname, username, token, gitProtocol string, encrypt bool) error { |
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'm assuming the encrypt flag will be implemented in a follow up?
This PR breaks up the
Configinterface and moves authentication methods into the newAuthConfig. This is done to make it easy to implement encrypted token storage. Essentially in any of theauthcode we can now useAuthConfiginstead ofConfig. There are no functional changes here and all test changes are done to now stub/mock outAuthConfiginstead ofConfig.supersedes: #7023
follow up: #7043
cc: #449