diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-11 14:09:50 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-11 14:09:50 -0600 |
| commit | 9edd3e64a6f1a56798e3881a6e404dba7c47c0da (patch) | |
| tree | 77a946c14a9db7c67adffbd76e4ebdac8138efe2 /pkg/authz/remote_check_service.go | |
| parent | 4ece9cd9d57c32cf593d445bed51883fb813a749 (diff) | |
chore: split the RemoteCheckService from the LocalCheckService
Diffstat (limited to 'pkg/authz/remote_check_service.go')
| -rw-r--r-- | pkg/authz/remote_check_service.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/authz/remote_check_service.go b/pkg/authz/remote_check_service.go new file mode 100644 index 0000000..43178fe --- /dev/null +++ b/pkg/authz/remote_check_service.go @@ -0,0 +1,28 @@ +package authz + +import ( + "context" + "errors" + + auth "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3" + "github.com/xlgmokha/x/pkg/x" +) + +type RemoteCheckService struct { + client auth.AuthorizationClient + auth.UnimplementedAuthorizationServer +} + +func NewRemoteCheckService(client auth.AuthorizationClient) auth.AuthorizationServer { + return &RemoteCheckService{ + client: client, + } +} + +func (svc *RemoteCheckService) Check(ctx context.Context, request *auth.CheckRequest) (*auth.CheckResponse, error) { + if x.IsZero(svc.client) { + return nil, errors.New("RPC client is not configured") + } + + return svc.client.Check(ctx, request) +} |
