aserto-dev / topaz

Cloud-native authorization for modern applications and APIs
https://www.topaz.sh
Apache License 2.0
1.08k stars 25 forks source link

Support custom headers to directory and authorizer #444

Closed ronenh closed 1 month ago

ronenh commented 1 month ago

This gives users the ability to configure topaz to include additional headers (gRPC metadata) in all directory calls. The remote_directory config value is alread an aserto.Config, which has a Headers field. This commit simply wires that into the underlying connection. Example:

remote_directory:
  address: directory.prod.aserto.com:8443
  api_key: <api key>
  tenant_id: <tenant ID>
  headers:
    header-1: value-1
    header-2: "value 2"

It also gives the same ability to the directory and authorizer CLI commands. For example:

topaz ds get manifest --headers "foo=bar;a=b"

or (same semantics):

topaz ds get manifest --headers "foo=bar" --headers "a=b"
coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 10477947833

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/app/directory/simple_resolver.go 3 5 60.0%
plugins/edge/plugin.go 0 9 0.0%
<!-- Total: 3 14 21.43% -->
Files with Coverage Reduction New Missed Lines %
plugins/edge/plugin.go 1 0.0%
pkg/cli/cc/ports.go 6 76.27%
<!-- Total: 7 -->
Totals Coverage Status
Change from base Build 10414409342: -0.2%
Covered Lines: 1321
Relevant Lines: 4688

💛 - Coveralls