summaryrefslogtreecommitdiff
path: root/pkg/authz/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/authz/server.go')
-rw-r--r--pkg/authz/server.go3
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(),