-
Notifications
You must be signed in to change notification settings - Fork 816
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
Adding middleware to inject Auth token for internal requests to frontend #4364
Merged
longquanzheng
merged 33 commits into
cadence-workflow:master
from
iamrodrigo:adding-middleware-for-frontend
Aug 30, 2021
+164
−103
Merged
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
f477bd1
New struct added to dispatcher
iamrodrigo 4f920bf
Merge branch 'master' into adding-middleware-for-frontend
iamrodrigo 348a195
Adding middleware to dispatcher
iamrodrigo 8b39a8a
Fixing test
iamrodrigo ce6ac31
Merge branch 'master' into adding-middleware-for-frontend
iamrodrigo 60e5ebe
moving auth creation client to common function
iamrodrigo dcd8197
Fixing conflict
iamrodrigo 2a5d7dc
files modified after running make bins
iamrodrigo d8f1464
bringing back comment
iamrodrigo 08f03fe
Merge branch 'adding-middleware-for-frontend' of github.com:noiarek/c…
iamrodrigo 2b1c39d
Using private key from current cluster and removing private key
iamrodrigo 3545030
Merge branch 'master' into adding-middleware-for-frontend
iamrodrigo d309a11
Rolling back changes on gen files
iamrodrigo 301a793
fixing import
iamrodrigo 75e3dcf
Deleting references to privatekey
iamrodrigo 36e20d8
Running make bins with go 1.16.7
iamrodrigo cd757b6
Revert "Running make bins with go 1.16.7"
iamrodrigo 135fa76
running make fmt
iamrodrigo a9b119d
removing test and privatekey path
iamrodrigo 2e74730
Updating field in struct to not to use pointer in interface
iamrodrigo 99de104
Fixing conflicts
iamrodrigo d6fc4f5
fixing import
iamrodrigo d5ac6f0
Merge branch 'master' into adding-middleware-for-frontend
longquanzheng b43e960
Merge branch 'master' into adding-middleware-for-frontend
longquanzheng 236c639
fix go.sum
longquanzheng 1e0a9c3
reset .gen
longquanzheng 521254a
fix mock
longquanzheng 5e3b073
reset unrelated changes
longquanzheng dc95838
reset
longquanzheng 4122cb2
optimize
longquanzheng 75acde7
improve logs
longquanzheng 1898ce8
fix kafka compose file
longquanzheng de48b9b
Merge branch 'master' into adding-middleware-for-frontend
longquanzheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ import ( | |
"time" | ||
|
||
"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" | ||
clientworker "go.uber.org/cadence/worker" | ||
|
||
"github.com/uber/cadence/client" | ||
"github.com/uber/cadence/common" | ||
|
@@ -220,8 +221,13 @@ func (s *server) startService() common.Daemon { | |
} | ||
} | ||
|
||
dispatcher, err := params.DispatcherProvider.Get(common.FrontendServiceName, s.cfg.PublicClient.HostPort) | ||
// will return empty array if not enabled | ||
privateKey, err := s.cfg.Authorization.OAuthAuthorizer.GetPrivateKey() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like the comment, use clusterMetadata.clusterInfomation..AuthorizationProvider You may need to create a new wrapper to create |
||
if err != nil { | ||
log.Fatalf("invalid private key path %s", s.cfg.Authorization.OAuthAuthorizer.JwtCredentials.PrivateKey) | ||
} | ||
authProvider := clientworker.NewJwtAuthorizationProvider(privateKey) | ||
dispatcher, err := params.DispatcherProvider.Get(common.FrontendServiceName, s.cfg.PublicClient.HostPort, &client.DispatcherOptions{AuthProvider: &authProvider}); if err != nil { | ||
log.Fatalf("failed to construct dispatcher: %v", err) | ||
} | ||
params.PublicClient = workflowserviceclient.New(dispatcher.ClientConfig(common.FrontendServiceName)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do I need to run something to get the latest mock for this? Quoting you @longquanzheng
There are two implementation, one is mock. The real one is dnsYarpcDispatcherProvider.