-
Notifications
You must be signed in to change notification settings - Fork 809
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
Adding middleware to inject Auth token for internal requests to frontend #4364
Conversation
cmd/server/cadence/server.go
Outdated
@@ -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 comment
The 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 AuthProvider
based on the config as it will be used in clientBean.go
go.mod
Outdated
@@ -91,3 +91,5 @@ replace github.com/apache/thrift => github.com/apache/thrift v0.0.0-201612212036 | |||
|
|||
// until new version is released we need to pick up https://github.com/yarpc/yarpc-go/pull/2047 | |||
replace go.uber.org/yarpc => go.uber.org/yarpc v1.52.1-0.20210303193224-b2caa40d56b6 | |||
|
|||
replace go.uber.org/cadence v0.17.1-0.20210806184645-7c70757e7c7f => /home/rv/go/src/go.uber.org/cadence |
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.
AuthorizationProvider
is currently internal interface. I have a diff to expose it, in the meantime I'm pointing to local. Reminder to myself to delete this before final review
client/clientBean.go
Outdated
@@ -256,7 +273,7 @@ func NewDNSYarpcDispatcherProvider(logger log.Logger, interval time.Duration) Di | |||
} | |||
} | |||
|
|||
func (p *dnsDispatcherProvider) Get(serviceName string, address string) (*yarpc.Dispatcher, error) { | |||
func (p *dnsDispatcherProvider) Get(serviceName string, address string, options *DispatcherOptions) (*yarpc.Dispatcher, error) { |
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.
Also, don't forget to remove the private key from Authorizer config. I thought we will use it in this PR but we changed our mind to make it separate(which is much better) |
host/xdc/elasticsearch_test.go
Outdated
@@ -18,8 +18,8 @@ | |||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
// THE SOFTWARE. | |||
|
|||
// +build !race | |||
// +build esintegration | |||
//go:build !race && esintegration |
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.
These file was modified after I ran make bins
, not sure if it will break something. Same with the next modification
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.
Did you try “make fmt”?
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.
I specifically made this new changes in a new commit just in case I need to revert :) I ran make fmt
and I got make: Nothing to be done for 'fmt'
. I reverted the last commit (removing all this changes) and tried make fmt
and got the same message. Should I revert them manually?
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.
Seems like a go 1.17 thing: https://golang.org/doc/go1.17#build-lines
Since we're not officially on 1.17... tbh I'm not sure if we should do this or not. And I'm fairly surprised that go fmt
does this since our stated version is 1.13, and older versions of go will not maintain them - if we ever change these build conditions and are not running <1.17, go fmt will ignore the new format, and 1.17+ will use the old (unmodified) conditions because it's now preferred.
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.
Are you referring to https://github.com/uber/cadence/blob/38881a8f996ce3230a77b7acc946438fbc532895/Dockerfile#L7
I think we should change it to 1.16.
@noiarek can you try using 1.16? If you use homebrew, there is a command to switch the go version.
Thanks @Groxx !
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.
I meant https://github.com/uber/cadence/blob/master/go.mod#L3 (actually go 1.12 apparently), but that works too / I imagine we build the tests from that dockerfile? If so, it wouldn't detect out-of-sync format directives without upgrading, yeah.
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.
@Groxx I've installed go 1.16.7 and ran make fmt
after it and I'm still getting this modifications. Any advice?
.gen/proto/api/v1/common.pb.go
Outdated
return ErrInvalidLengthCommon | ||
} | ||
if (iNdEx + skippy) < 0 { | ||
if (skippy < 0) || (iNdEx+skippy) < 0 { |
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.
It seems like this is due to some version upgrade in the proto tool, so I believe that's fine.
Cc @Groxx
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.
This shouldn't be affected unless the makefile's versioned proto tool was changed, which this diff doesn't do.
The two branches that are merged are identical though, possibly a newer go fmt -s
did this?
…adence into adding-middleware-for-frontend
This reverts commit 36e20d8.
Pull Request Test Coverage Report for Build 86bab5c0-970a-4756-abf3-35a46567c138
💛 - Coveralls |
What changed?
Why?
For https://docs.google.com/document/d/1a-Xo9FSCLubYlIQHB_eX5j4Yv2GDv_82J94At2dAL3o/edit#
How did you test it?
Local test:
and start server with
then register a domain and start two workflows
then use batch to terminate the two workflows
and confirm it succeeded
Potential risks
Release notes
Documentation Changes