macaroon

package
v1.18.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

package: macaroon / authn type: adapter job: authenticate a macaroon, translating its caveats into attenuated grants limits: verification only — this server never mints or attenuates one (-> auth.New)

Tokens are untrusted external input; this backend verifies, never mints. Each first-party caveat is one "RIGHTS glob" grant and one attenuation step, ALL of which must hold; an unparseable or third-party caveat refuses the whole token.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

Auth is the macaroon backend: the root key its signature chains verify against. The key is symmetric — holding it can mint tokens too, not just verify them, so a leaked config is a forging key living in two places.

func New

func New(ctx context.Context, cfg scope.Section) (*Auth, error)

New builds the backend from the section's "root_key" — the symmetric secret shared with whatever external system mints macaroons for this server.

func (*Auth) Authenticate

func (a *Auth) Authenticate(_ context.Context, token string) (access.Principal, error)

Authenticate decodes and verifies token against the root key, parsing each first-party caveat as a Grant (see the package doc) — id becomes Account.

func (*Auth) Scheme

func (a *Auth) Scheme() string

Scheme is the credential scheme consumed — a literal equal to auth.SchemeMacaroon.

Directories

Path Synopsis
package: macaroontest / authn type: test-support job: the macaroon backend's conformance setup hook, and a minting helper for fixtures limits: a test helper; only tests import it — this server never mints a macaroon itself
package: macaroontest / authn type: test-support job: the macaroon backend's conformance setup hook, and a minting helper for fixtures limits: a test helper; only tests import it — this server never mints a macaroon itself

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL