Skip to content

Commit

Permalink
extend permission attributes for service auth
Browse files Browse the repository at this point in the history
  • Loading branch information
mkolodezny committed Sep 10, 2021
1 parent e602b8c commit d1a3c11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions common/authorization/authorizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ type (
// Attributes is input for authority to make decision.
// It can be extended in future if required auth on resources like WorkflowType and TaskList
Attributes struct {
Actor string
APIName string
DomainName string
TaskList *types.TaskList
Permission Permission
Actor string
APIName string
DomainName string
WorkflowType *types.WorkflowType
TaskList *types.TaskList
Permission Permission
}

// Result is result from authority.
Expand Down
7 changes: 4 additions & 3 deletions service/frontend/accessControlledHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,9 +675,10 @@ func (a *AccessControlledWorkflowHandler) StartWorkflowExecution(
scope := a.getMetricsScopeWithDomain(metrics.FrontendStartWorkflowExecutionScope, request)

attr := &authorization.Attributes{
APIName: "StartWorkflowExecution",
DomainName: request.GetDomain(),
Permission: authorization.PermissionWrite,
APIName: "StartWorkflowExecution",
DomainName: request.GetDomain(),
Permission: authorization.PermissionWrite,
WorkflowType: request.WorkflowType,
}
isAuthorized, err := a.isAuthorized(ctx, attr, scope)
if err != nil {
Expand Down

0 comments on commit d1a3c11

Please sign in to comment.