Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Added token login to fly #185

Merged
merged 1 commit into from Jul 31, 2017
Merged

Added token login to fly #185

merged 1 commit into from Jul 31, 2017

Conversation

Chumper
Copy link

@Chumper Chumper commented Jul 21, 2017

@vito
@jtarchie
@chendrix

Please review & merge.
This is linked to vmware-archive/atc#184 which needs to be merged first for fly to support token login.

This PR enables the user to do the following:

./fly login -c http://localhost:8080 -t main -n openCloak --token c8294f0dd721dbba7cf39a9ea882eed1273ab8ca
logging in to team 'openCloak'

Yeah, who needs the web auth flow anyway? Token FTW!

target saved

or

 ./fly login -c http://localhost:8080 -t main -n openCloak
logging in to team 'openCloak'

navigate to the following URL in your browser:

    http://127.0.0.1:8080/auth/github?team_name=openCloak&fly_local_port=56424

or enter one of the following token types:
    - Personal access token (e.g. 1233456789)
    - Bearer token (e.g. 'Bearer 1234567890'

Token: a5ea7763eb91fb0863cc8335879be34b7f8691fe

target saved

This also works with multiple auth methods.
Please note the failing tests because the atc PR is not merged yet.

@jtarchie
Copy link
Contributor

@Chumper, it looks like the tests failed on this build.

@Chumper
Copy link
Author

Chumper commented Jul 24, 2017

Yes, that is because the PR on ATC side needs to be merged first. It introduces the missing tokenUrl.
As the ATC tests are passing here https://ci.concourse.ci/builds/45871 I expect this tests to pass too after merging as it also passed locally.

Copy link
Contributor

@jtarchie jtarchie left a comment

Choose a reason for hiding this comment

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

please see comments

@@ -279,6 +308,25 @@ func waitForTokenInput(tokenChannel chan string, errorChannel chan error) {
}
}

func usePersonalToken(tokenUrl string, token string) (string, error) {
response, err := http.Post(tokenUrl, "text/plain", strings.NewReader(token))
Copy link
Contributor

Choose a reason for hiding this comment

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

@Chumper, this http.Post bit us because it does respect the --insecure, which does skip ssl validation. Are you able to pass this as an option?

@Chumper
Copy link
Author

Chumper commented Jul 29, 2017

Updated the PR to take the insecure option into account

@topherbullock topherbullock merged commit 1dbc061 into vmware-archive:master Jul 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants