blob: 5dfdfa848d714a14eeea1ba35e243e8c8eb3afc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package authz
import (
"context"
"errors"
auth "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls"
)
type CompositeCheckService struct {
services []auth.AuthorizationServer
auth.UnimplementedAuthorizationServer
}
func NewCheckService(services []auth.AuthorizationServer) auth.AuthorizationServer {
return &CompositeCheckService{
services: services,
}
}
func (svc *CompositeCheckService) Check(ctx context.Context, request *auth.CheckRequest) (*auth.CheckResponse, error) {
for _, client := range svc.services {
response, err := client.Check(ctx, request)
if err != nil {
pls.LogError(ctx, err)
continue
}
return response, err
}
return nil, errors.New("Unable to perform check")
}
|