Documentation
¶
Overview ¶
Package testauth is an auth.Authenticator for ContentKit's package tests, which cannot import a real provider: a request's bearer names its actor (As) and an Authorizer answers its Can. The end-to-end suite (e2e/) runs the same gates against a real AuthKit.
Index ¶
- Constants
- Variables
- func Actor(a access.Actor, authz Authorizer) access.Actor
- func As(r *http.Request, a access.Actor) *http.Request
- func Token(a access.Actor) string
- func Verify(a access.Actor, authz Authorizer) (auth.Verified, error)
- type All
- type Auth
- type Authorizer
- type None
- type ScopedAuthorizer
Constants ¶
const Issuer = "https://auth.test"
Issuer is the test credentials' issuer.
Variables ¶
var Scope = auth.Scope{Authority: Issuer, ID: "root"}
Scope is the test Authenticator's root scope, where staff hold their permissions.
Functions ¶
func Actor ¶
func Actor(a access.Actor, authz Authorizer) access.Actor
Actor is a as the gate builds it, with a Verified answering Can by authz, for calls that take an actor directly.
Types ¶
type Auth ¶
type Auth struct {
Authz Authorizer
Claims map[string][]string
}
Auth authenticates "Bearer user:{id}" and "Bearer app:{id}"; any other bearer is refused. Authz answers Can in Scope; nil holds nothing. Claims are a subject's token entitlement claims (access.Entitled).
type Authorizer ¶
Authorizer decides a test actor's permissions in Scope.