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

flank auth login #449

Merged
merged 1 commit into from Jan 10, 2019

Conversation

Projects
None yet
3 participants
@bootstraponline
Copy link
Contributor

bootstraponline commented Jan 9, 2019

Fix #398

Flank now allows you to login as a user. Type flank auth login and follow the web prompt. User auth is an alternative to using a service account.

@bootstraponline bootstraponline force-pushed the gcloud_auth branch 3 times, most recently from 5394c79 to 64deb6f Jan 10, 2019

@TestArmada TestArmada deleted a comment from codecov-io Jan 10, 2019

@bootstraponline bootstraponline changed the title WIP | Gcloud auth flank auth login Jan 10, 2019

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Jan 10, 2019

Codecov Report

Merging #449 into master will decrease coverage by 0.76%.
The diff coverage is 49.01%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #449      +/-   ##
============================================
- Coverage     79.32%   78.55%   -0.77%     
- Complexity      630      640      +10     
============================================
  Files            69       73       +4     
  Lines          1790     1833      +43     
  Branches        271      272       +1     
============================================
+ Hits           1420     1440      +20     
- Misses          195      217      +22     
- Partials        175      176       +1

@bootstraponline bootstraponline force-pushed the gcloud_auth branch from 807520a to c587bb4 Jan 10, 2019

@@ -36,6 +39,10 @@ class Main : Runnable {
private var printVersion = false

companion object {
init {
// GoogleApiLogger.logAllToStdout()

This comment has been minimized.

@valeraz

valeraz Jan 10, 2019

Collaborator

Is this left here for debugging purposes?

This comment has been minimized.

@bootstraponline

bootstraponline Jan 10, 2019

Contributor

Yeah, I think it'll be cleaned up as part of #446

import java.io.IOException

// https://github.com/googleapis/google-oauth-java-client
// Code from: https://developers.google.com/sheets/api/quickstart/java

This comment has been minimized.

@valeraz

valeraz Jan 10, 2019

Collaborator

I'd help to add some context to the comment (like why you chose to copy from sheets)

This comment has been minimized.

@bootstraponline

bootstraponline Jan 10, 2019

Contributor

I updated the comment. The usage of GoogleAuthorizationCodeFlow is the same for any Google service. When the API changes, Google updates their official reference documentation.

HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport()
DATA_STORE_FACTORY = FileDataStoreFactory(CRED_FOLDER)
} catch (t: Throwable) {
t.printStackTrace()

This comment has been minimized.

@valeraz

valeraz Jan 10, 2019

Collaborator

Not sure if this is copied code or not, but why not let the exception propagate or just rethrow it as a RuntimeException?

This comment has been minimized.

@bootstraponline

bootstraponline Jan 10, 2019

Contributor

That's a good point. Updated.

}
}

fun activateUserAuth(): Boolean {

This comment has been minimized.

@valeraz

valeraz Jan 10, 2019

Collaborator

missing kdoc. Also, it seems strange that this would return a boolean (based on the naming of the method).

This comment has been minimized.

@bootstraponline

bootstraponline Jan 10, 2019

Contributor

renamed to hasUserAuth

This comment has been minimized.

@bootstraponline

bootstraponline Jan 10, 2019

Contributor

kdoc isn't used at the moment on the methods. A PR will be adding detekt support soon. At that point we may decide to enforce function docs.

val CRED = File(CRED_FOLDER, "StoredCredential")

// https://github.com/bootstraponline/gcloud_cli/blob/40521a6e297830b9f652a9ab4d8002e309b4353a/google-cloud-sdk/platform/gsutil/gslib/utils/system_util.py#L177
private val clientId = "32555940559.apps.googleusercontent.com"

This comment has been minimized.

@valeraz

valeraz Jan 10, 2019

Collaborator

Is it by design that these are hardcoded?

This comment has been minimized.

@bootstraponline

bootstraponline Jan 10, 2019

Contributor

Yep, they're hardcoded in gcloud CLI as well.

@bootstraponline bootstraponline force-pushed the gcloud_auth branch from 00fb8c0 to b5e18c1 Jan 10, 2019

@bootstraponline bootstraponline force-pushed the gcloud_auth branch from b5e18c1 to 099efb5 Jan 10, 2019

@bootstraponline bootstraponline merged commit f710c18 into master Jan 10, 2019

3 of 4 checks passed

codecov/project 78.55% (-0.77%) compared to 55c2d53
Details
ci/bitrise/9767f3e19047d4db/pr Passed - Flank | macOS Public
Details
ci/bitrise/fbdede5ce50cbc21/pr Passed - Flank | Ubuntu Public
Details
license/cla Contributor License Agreement is signed.
Details

@bootstraponline bootstraponline deleted the gcloud_auth branch Jan 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment