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
Discard the local login server on non-desktop environment #1502
Conversation
@@ -21,3 +21,11 @@ func NewOsOpener(logger *logrus.Logger) *OsOpener { | |||
logger: logger, | |||
} | |||
} | |||
|
|||
// OpenerFunc is a func adapter for the Opener interface. | |||
type OpenerFunc func(string) 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.
This is used only in test https://github.com/dcos/dcos-cli/pull/1502/files#diff-48a7e37bb2ef223e6225547541997ea1R58 so it can be placed in _test.go
file
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.
Even though it is only used in a test right now, it is meant to be exposed to other projects using this package (to provide a custom open mechanism, or for their own tests).
@@ -167,29 +167,39 @@ func (f *Flow) triggerMethod(provider *Provider) (acsToken string, err error) { | |||
if provider.ID == DCOSOIDCAuth0 { | |||
loginServer, err = loginserver.New(startFlowURL) | |||
if err != nil { | |||
return "", err | |||
f.logger.Error(err) |
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.
Previously we returned at this point. Why this change?
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.
This lets use fallback to reading from stdin in that case.
For the `dcos-oidc-auth0` login provider, when the user operates the CLI from a container or a remote machine, the local webserver will not run on the same machine as the browser. Later on the browser will try to send the token to eg. `localhost:43383`, which won't be reachable. When this situation arises, we had designed the UI to fallback to printing the login token for copy-pasting, but once the CLI has successfully initiated the local web server, it doesn't accept input from STDIN at all, so the user has no chance to copy-paste the token. This commit updates the CLI to fallback to reading from STDIN when the browser can't be opened. Note: as an alternative, it would have been possible to concurrently wait for data on both the local web server and STDIN, but the current fix is simpler and covers the container / remote use-cases as expected. https://jira.mesosphere.com/browse/DCOS_OSS-5591
11f5e46
to
fe9242e
Compare
@mesosphere-ci run integration tests |
This fixes a regression introduced in dcos#1502. https://jira.mesosphere.com/browse/DCOS-60349
This fixes a regression introduced in dcos#1502. This issue only happens on non-desktop environments. https://jira.mesosphere.com/browse/DCOS-60349
This fixes a regression introduced in dcos#1502, which can cause a panic on non-desktop environments with browser-based login flows other than auth0. https://jira.mesosphere.com/browse/DCOS-60349
This fixes a regression introduced in dcos#1502, which can cause a panic on non-desktop environments with browser-based login flows other than auth0. https://jira.mesosphere.com/browse/DCOS-60349
This fixes a regression introduced in dcos#1502, which can cause a panic on non-desktop environments with browser-based login flows other than auth0. https://jira.mesosphere.com/browse/DCOS-60349
This fixes a regression introduced in #1502, which can cause a panic on non-desktop environments with browser-based login flows other than auth0. https://jira.mesosphere.com/browse/DCOS-60349
For the
dcos-oidc-auth0
login provider, when the user operates the CLIfrom a container or a remote machine, the local webserver will not run
on the same machine as the browser. Later on the browser will try to
send the token to eg.
localhost:43383
, which won't be reachable.When this situation arises, we had designed the UI to fallback to
printing the login token for copy-pasting, but once the CLI has
successfully initiated the local web server, it doesn't accept input
from STDIN at all, so the user has no chance to copy-paste the token.
This commit updates the CLI to fallback to reading from STDIN when the
browser can't be opened.
Note: as an alternative, it would have been possible to concurrently
wait for data on both the local web server and STDIN, but the current
fix is simpler and covers the container / remote use-cases as expected.
https://jira.mesosphere.com/browse/DCOS_OSS-5591