auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Overview

Package auth holds reduced public authentication contracts.

Index

Constants

View Source
const (
	ClaimSubject = "sub"
	ClaimEmail   = "email"
	ClaimScope   = "scope"
)

Variables

View Source
var (
	ErrInvalidToken = errors.New("invalid token")
	ErrExpiredToken = errors.New("expired token")
)

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Authenticate(ctx context.Context, token Token) (Principal, error)
}

Authenticator is the reduced stdlib-only authentication contract.

type Claims

type Claims map[string]interface{}

Claims carries normalized auth claims without tying the public surface to a specific vendor payload type.

type Principal

type Principal struct {
	Subject string
	Email   string
	Claims  Claims
}

Principal is the reduced authenticated identity returned by an Authenticator.

type Token

type Token struct {
	Value string
}

Token is the extracted credential payload presented to an authenticator. Transport-specific decoration such as the Authorization header name or "Bearer " prefix should be removed before authentication.

type Vendor

type Vendor string

Vendor identifies one supported authentication backend family.

const (
	VendorJWT      Vendor = "jwt"
	VendorCognito  Vendor = "cognito"
	VendorFirebase Vendor = "firebase"
)

Jump to

Keyboard shortcuts

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