Versions in this module Expand all Collapse all v0 v0.0.1 Dec 6, 2024 Changes in this version + const RuleAdminOnly + const RuleAdminOrSubject + const RuleAny + const RuleAuthenticate + const RuleUserOnly + var ErrForbidden = errors.New("attempted action is not allowed") + type Auth struct + func New(cfg Config) (*Auth, error) + func (a *Auth) Authenticate(ctx context.Context, bearerToken string) (Claims, error) + func (a *Auth) Authorize(ctx context.Context, claims Claims, userID uuid.UUID, rule string) error + func (a *Auth) GenerateToken(kid string, claims Claims) (string, error) + func (a *Auth) Issuer() string + type Claims struct + Roles []string + type Config struct + DB *sqlx.DB + Issuer string + KeyLookup KeyLookup + Log *logger.Logger + type KeyLookup interface + PrivateKey func(kid string) (key string, err error) + PublicKey func(kid string) (key string, err error)