diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-22 17:35:49 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-22 17:35:49 -0600 |
| commit | 20ef0d92694465ac86b550df139e8366a0a2b4fa (patch) | |
| tree | 3f14589e1ce6eb9306a3af31c3a1f9e1af5ed637 /pkg/authz/server.go | |
| parent | 44e0d272c040cdc53a98b9f1dc58ae7da67752e6 (diff) | |
feat: connect to spicedb
Diffstat (limited to 'pkg/authz/server.go')
| -rw-r--r-- | pkg/authz/server.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/authz/server.go b/pkg/authz/server.go index c54077b..6fb0f99 100644 --- a/pkg/authz/server.go +++ b/pkg/authz/server.go @@ -3,6 +3,7 @@ package authz import ( "context" + "github.com/authzed/authzed-go/v1" auth "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3" xcontext "github.com/xlgmokha/x/pkg/context" "github.com/xlgmokha/x/pkg/log" @@ -13,6 +14,7 @@ import ( ) var Connection xcontext.Key[*grpc.ClientConn] = xcontext.Key[*grpc.ClientConn]("grpc_client") +var Client xcontext.Key[*authzed.Client] = xcontext.Key[*authzed.Client]("authzed_client") type Server struct { *grpc.Server @@ -38,6 +40,7 @@ func New(ctx context.Context, options ...grpc.ServerOption) *Server { func authorizationServiceFor(ctx context.Context) auth.AuthorizationServer { connection := Connection.From(ctx) svcs := []auth.AuthorizationServer{NewLocalCheckService()} + if x.IsPresent(connection) { pls.LogNow(ctx, log.Fields{"authzd": map[string]string{ "target": connection.CanonicalTarget(), |
