Documentation
¶
Overview ¶
Package usertoken authenticates a request by a per-user token that an administrator issued. The service keeps only the hash of the token, so the identity needs no external provider.
Index ¶
Constants ¶
const Prefix = "mtu_"
Prefix starts every token, so that a credential of another kind never reaches the store.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Record ¶
type Record struct {
Principal string
Scope string
Repos []string
ExpiresAt time.Time
RevokedAt time.Time
}
Record is a stored token: who holds it, what it allows, and when it ends. Repos is empty for the scope admin.
type Verifier ¶
Verifier reads the token that Token returns, finds its record by hash, and refuses a token that is unknown, revoked or expired.
func (Verifier) Lookup ¶
Lookup returns the record of the token of r, or an error for a token that is unknown, revoked, expired or of a scope that a person may not hold.