-
Notifications
You must be signed in to change notification settings - Fork 111
/
types.go
38 lines (29 loc) · 1.02 KB
/
types.go
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
35
36
37
38
package middleware
import (
"context"
"google.golang.org/grpc"
"github.com/chef/automate/api/external/iam/v2/pairs"
)
// AuthorizationInterceptor abstracts the common logic that can be used for both
// interceptor types.
type AuthorizationInterceptor interface {
UnaryServerInterceptor() grpc.UnaryServerInterceptor
StreamServerInterceptor() grpc.StreamServerInterceptor
}
type DeploymentCertAuthOnly interface {
MustUseDeploymentCertAuth()
}
type GRPCAuthorizationHandler interface {
Handle(ctx context.Context, subjects []string, projects []string, req interface{}) (context.Context, error)
}
type HTTPAuthorizationHandler interface {
IsAuthorized(ctx context.Context, subjects []string, resource, action string, projects []string) (context.Context, bool, error)
}
type IntrospectionHandler interface {
FilterAuthorizedPairs(ctx context.Context, subjects []string, pairs []*pairs.Pair) ([]*pairs.Pair, error)
}
type AuthorizationHandler interface {
HTTPAuthorizationHandler
GRPCAuthorizationHandler
IntrospectionHandler
}