forked from projectatomic/atomic-enterprise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.go
29 lines (24 loc) · 1.06 KB
/
interfaces.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
package authorizer
import (
"net/http"
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
)
type Authorizer interface {
Authorize(ctx kapi.Context, a AuthorizationAttributes) (allowed bool, reason string, err error)
GetAllowedSubjects(ctx kapi.Context, attributes AuthorizationAttributes) ([]string, []string, error)
}
type AuthorizationAttributeBuilder interface {
GetAttributes(request *http.Request) (AuthorizationAttributes, error)
}
type AuthorizationAttributes interface {
GetVerb() string
// GetResource returns the resource type. If IsNonResourceURL() is true, then GetResource() is "".
GetResource() string
GetResourceName() string
// GetRequestAttributes is of type interface{} because different verbs and different Authorizer/AuthorizationAttributeBuilder pairs may have different contract requirements.
GetRequestAttributes() interface{}
// IsNonResourceURL returns true if this is not an action performed against the resource API
IsNonResourceURL() bool
// GetURL returns the URL path being requested, including the leading '/'
GetURL() string
}