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

cli: [FEAT] Add login command #14

Merged
merged 3 commits into from
Jan 16, 2019
Merged

cli: [FEAT] Add login command #14

merged 3 commits into from
Jan 16, 2019

Conversation

mdjunior
Copy link
Contributor

@mdjunior mdjunior commented Jan 15, 2019

This PR adds a login command using OpenID Connect flow with PKCE.

When executing the login command, the CLI client does a GET /status/config discovery call in the API and retrieves some information (Issuer URL and ClientID - named as oidc_base_url+oidc_realm and oidc_audience). With this information the CLI client has the information for an Authorization Code Flow with PKCE.
After this, the client starts a local web server (using a random port) and opens a web browser with OAuth 2.0 provider's consent page. After login in provider, the code argument is directed to the local server and the client terminates the flow.
The tokens are stored on OS keyring (refresh and access).

Help output:

$ gshc login -h

Initiates a new gsh session for a user. How authentication uses OpenID
Connect, it will open a web browser for the user to complete the login.

All gshc actions require the user to be authenticated (except [[gshc login]],
 [[gshc version]] and [[gshc target-*]]).

Usage:
  gshc login [flags]

Flags:
  -h, --help   help for login

Global Flags:
      --config string   config file (default is $HOME/.gshc.yaml)

@fbomlisboa fbomlisboa merged commit 64cf690 into master Jan 16, 2019
@mdjunior mdjunior deleted the cli-login branch January 16, 2019 01:10
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.

2 participants