Skip to content

Commit

Permalink
Check share ID in auth interceptor for lw accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Jun 4, 2021
1 parent d432a83 commit 85bb7a1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions internal/grpc/interceptors/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,25 @@ func dismantleToken(ctx context.Context, tkn string, req interface{}, mgr token.
}
}
}
} else { // ref has ID present
client, err := pool.GetGatewayServiceClient(gatewayAddr)
if err != nil {
return nil, err
}
for k := range tokenScope {
if strings.HasPrefix(k, "lightweight") {
shares, err := client.ListReceivedShares(ctx, &collaboration.ListReceivedSharesRequest{})
if err != nil || shares.Status.Code != rpc.Code_CODE_OK {
log.Warn().Err(err).Msg("error listing received shares")
continue
}
for _, share := range shares.Shares {
if utils.ResourceEqual(share.Share.ResourceId, ref.GetId()) {
return u, nil
}
}
}
}
}
}

Expand Down

0 comments on commit 85bb7a1

Please sign in to comment.