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

Feature cont.: authorize CLI as admin with private #4338

Merged
merged 16 commits into from
Jul 31, 2021

Conversation

iamrodrigo
Copy link
Contributor

@iamrodrigo iamrodrigo commented Jul 31, 2021

What changed?
--jwt-private-key flag added to CLI

Why?
Requested in this proposal

How did you test it?
Tested locally

./cadence-server --env development_oauth start

and

./cadence --do samples-domain --jwt-private-key config/credentials/keytest domain desc

Potential risks
Nothing

Release notes
When the whole proposal is implemented

Documentation Changes
When the whole proposal is implemented

@iamrodrigo iamrodrigo changed the title [WIP] Create token on cli Create token on cli Jul 31, 2021
@iamrodrigo iamrodrigo changed the title Create token on cli Create JWT on cli Jul 31, 2021
Copy link
Contributor

@longquanzheng longquanzheng left a comment

Choose a reason for hiding this comment

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

Looks great

tools/cli/app.go Outdated
@@ -69,6 +69,11 @@ func NewCliApp() *cli.App {
Usage: "optional JWT for authorization",
EnvVar: "CADENCE_CLI_JWT",
},
cli.StringFlag{
Name: FlagJWTPrivateKey,
Usage: "optional private key path to create JWT",
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: how about adding a comment about only one of the two options is needed to use jwt authorization?

KeyTypePublic KeyType = "public key"
)

func loadRSAKey(path string, keyType KeyType) (interface{}, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍👍👍

tools/cli/app.go Outdated
EnvVar: "CADENCE_CLI_JWT",
},
cli.StringFlag{
Name: FlagJWTPrivateKeyWithAlias,
Usage: "optional private key path to create JWT. Either this or --jwt is needed for jwt authentication. --jwt flag has priority over this one if both provided",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've never been quite good with text description @longquanzheng is this decent enough? 😆

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great. Thanks 😊

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohh can you say authorization instead of authentication?

Copy link
Contributor

Choose a reason for hiding this comment

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

This feature doesn’t verify the user identity. The provided jwt token is to verify the access. I think by concept the authentication part (using username password or one login) is done in the OAuth integration by the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is my classic typo. Updated :)

@longquanzheng longquanzheng changed the title Create JWT on cli Feature cont.: authorize CLI as admin with private Jul 31, 2021
@coveralls
Copy link

Pull Request Test Coverage Report for Build d63d614f-7e0a-4f62-8c57-17b687794216

  • 28 of 92 (30.43%) changed or added relevant lines in 5 files are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.04%) to 56.834%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tools/cli/util.go 10 38 26.32%
common/rsa.go 0 36 0.0%
Files with Coverage Reduction New Missed Lines %
common/task/fifoTaskScheduler.go 2 87.63%
common/task/weightedRoundRobinTaskScheduler.go 2 89.12%
service/history/queue/timer_queue_processor.go 2 58.77%
Totals Coverage Status
Change from base Build 330df7ea-6f71-48f1-baa5-2628c6089413: 0.04%
Covered Lines: 78054
Relevant Lines: 137337

💛 - Coveralls

@longquanzheng longquanzheng merged commit 9a46d9d into cadence-workflow:master Jul 31, 2021
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.

3 participants