Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
rancher loginonly accepts an API token (--token). This adds signing in with one of the server's auth providers instead, reusing the login flows the kubectl credential plugin (rancher token/rancher auth get-token, #698) already has.--auth-flow authcode([Token]: Add OAuth auth code flow for easier authentication #530, Azure AD in Implement authorization code flow for AzureAD #550). Other providers prompt for a username and password.--auth-provider,--auth-flow,--skip-browser(print the login URL instead of opening a browser).--auth-providertakes a provider name or type, as in Try and find the correct provider by name rather than type. #743. Without it, the CLI asks which provider to use if the server has more than one.--tokenworks as before. Combining it with the new flags is an error.cli2.json(tokenExpiresAt). Once it has passed, commands tell the user to runrancher loginagain instead of failing with an auth error. Tokens given with--tokenhave no stored expiry and aren't checked.Testing
cmd/login_test.goandconfig/config_test.go.go build ./...andgo testpass.rancher loginwithout--tokensigned in through the browser, saved the token and its expiry, and later commands used it.