-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthorizer.go
More file actions
22 lines (20 loc) · 922 Bytes
/
authorizer.go
File metadata and controls
22 lines (20 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package canery
import "context"
// Authorizer evaluates authorization requests and exposes a fluent request
// builder rooted on a subject.
//
// Engine is the default implementation shipped by the package, but the
// interface is intentionally broad enough for alternate evaluators over the
// same request model.
type Authorizer interface {
// CheckDecision evaluates a low-level request directly and returns the
// explicit decision object.
CheckDecision(ctx context.Context, request Request) (Decision, error)
// CheckTrace evaluates a low-level request directly and also returns a
// high-level trace of the evaluation flow for debugging.
CheckTrace(ctx context.Context, request Request) (Decision, Trace, error)
// Check evaluates a low-level request directly.
Check(ctx context.Context, request Request) (bool, error)
// For starts a fluent builder for the given subject.
For(subject Subject) Builder
}