Documentation
¶
Overview ¶
Package devauth is DEVELOPMENT-ONLY identity for a stack running on a developer's own machine. Never expose a process using it to anyone else.
Anyone who knows the dev token can sign in as ANY username of the one tenant. The credential is "<username>:<token>", presented as a bearer token (Authorization: Bearer alice:<token>, for curl and tests) or as the CookieName cookie the /dev/login form sets. There is no per-user password, no server-side logout and no rate limiting.
The Identity it returns is marked DevelopmentOnly: stack refuses to start it without a Logger, and logs a WARN banner on every start.
In production, implement identity.Verifier over your identity provider (a signed session cookie, an OIDC access token) and factory.Authorizer with your ownership rules; nothing else in a stack composition changes.
Index ¶
Constants ¶
const CookieName = "looprig_dev"
CookieName is the browser cookie the /dev/login form sets.
const MinTokenBytes = 16
MinTokenBytes is the shortest dev token New accepts.
Variables ¶
var ErrShortToken = errors.New("devauth: the dev token is shorter than MinTokenBytes")
ErrShortToken is New's refusal of a token under MinTokenBytes.
Functions ¶
This section is empty.
Types ¶
type Dev ¶
type Dev struct {
// contains filtered or unexported fields
}
Dev is one development identity: one tenant, one shared token.
func New ¶
func New(tenant sessionwire.TenantID, token string) (*Dev, error)
New returns a development identity for tenant. An empty token mints a random one (read it back with Token).
func (*Dev) Credential ¶
Credential is the bearer credential for user: "<user>:<token>".
func (*Dev) Identity ¶
Identity is the stack.Identity: the dev verifier, factory.TenantAuthorizer, a per-process CSRF key and the dev cookie. It is marked DevelopmentOnly.