Documentation
¶
Overview ¶
Package auth emulates altengine's data-plane authentication: a Bearer API key resolves to an org + a grants map. For local development the emulator runs "dev-open": any non-empty Bearer token is accepted and mapped to the single dev org with full grants on every service. Explicitly minted keys (via the admin console) are still honored with their real grants so a developer can exercise grant-scoping locally.
Index ¶
Constants ¶
const DevOrgID = "dev"
Variables ¶
This section is empty.
Functions ¶
func CarryOnBehalf ¶ added in v0.2.34
CarryOnBehalf copies the on-behalf grants of `from`, if any, onto `to` — for a handler that re-dispatches a request in process.
func WithOnBehalfGrants ¶ added in v0.2.34
WithOnBehalfGrants marks an in-process request as made for a caller whose grants are narrower than the bearer it carries — a function's env.* binding, whose grants were checked before the request was built. It rides the request context, so nothing outside the process can set it.
Types ¶
type Grants ¶
Grants maps "service", "service:prefix*" or "service:instance" to a level string.
func (Grants) Effective ¶
Effective returns the level for (service, instance), resolved as hosted altengine does: the exact instance entry, else the longest "service:prefix*" entry the name starts with (`*` matches zero or more characters), else the service-wide entry. The most specific entry wins even when it is lower.
type Level ¶
type Level int
Level is a grant level; read < write < full (full includes delete).
func EffectiveLevel ¶ added in v0.2.34
EffectiveLevel is the level a request really holds on (service, instance): the identity's grant, narrowed by the grants of whoever it was made on behalf of. For a handler whose OUTCOME depends on the level beyond the one Require already checked.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds minted API keys (hash -> Identity) for the realism path. Dev-open mode resolves unknown tokens to full access rather than rejecting them.