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: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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