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

Implementation of JWTAuthorizationProvider #1116

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.13

require (
github.com/apache/thrift v0.0.0-20161221203622-b2a4d4ae21c7
github.com/cristalhq/jwt/v3 v3.1.0
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.4.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cristalhq/jwt/v3 v3.1.0 h1:iLeL9VzB0SCtjCy9Kg53rMwTcrNm+GHyVcz2eUujz6s=
github.com/cristalhq/jwt/v3 v3.1.0/go.mod h1:XOnIXst8ozq/esy5N1XOlSyQqBd+84fxJ99FK+1jgL8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
16 changes: 12 additions & 4 deletions internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/uber-go/tally"
"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient"
s "go.uber.org/cadence/.gen/go/shared"
"go.uber.org/cadence/internal/common/auth"
"go.uber.org/cadence/internal/common/metrics"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -336,6 +337,7 @@ type (
Tracer opentracing.Tracer
ContextPropagators []ContextPropagator
FeatureFlags FeatureFlags
Authorization auth.AuthorizationProvider
}

// StartWorkflowOptions configuration parameters for starting a workflow execution.
Expand Down Expand Up @@ -542,9 +544,12 @@ func NewClient(service workflowserviceclient.Interface, domain string, options *
} else {
tracer = opentracing.NoopTracer{}
}

if options.Authorization != nil{
service = auth.NewWorkflowServiceWrapper(service, options.Authorization)
}
service = metrics.NewWorkflowServiceWrapper(service, metricScope)
return &workflowClient{
workflowService: metrics.NewWorkflowServiceWrapper(service, metricScope),
workflowService: service,
domain: domain,
registry: newRegistry(),
metricsScope: metrics.NewTaggedScope(metricScope),
Expand All @@ -569,9 +574,12 @@ func NewDomainClient(service workflowserviceclient.Interface, options *ClientOpt
metricScope = options.MetricsScope
}
metricScope = tagScope(metricScope, tagDomain, "domain-client", clientImplHeaderName, clientImplHeaderValue)

if options.Authorization != nil{
service = auth.NewWorkflowServiceWrapper(service, options.Authorization)
}
service = metrics.NewWorkflowServiceWrapper(service, metricScope)
return &domainClient{
workflowService: metrics.NewWorkflowServiceWrapper(service, metricScope),
workflowService: service,
metricsScope: metricScope,
identity: identity,
featureFlags: getFeatureFlags(options),
Expand Down
Loading