auth

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package auth defines the Verifier interface used by the server to validate bearer tokens at the session.hello handshake.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidToken = errors.New("auth: invalid token")

ErrInvalidToken is returned by StaticBearer when the token is not in the configured set.

Functions

This section is empty.

Types

type Verifier

type Verifier interface {
	Verify(ctx context.Context, token string) (principal string, err error)
}

Verifier validates a bearer token and returns the authenticated principal name.

func StaticBearer

func StaticBearer(tokens map[string]string) Verifier

StaticBearer returns a Verifier that accepts a fixed set of tokens. The map keys are the accepted token strings; the values are the resulting principal identifiers.

type VerifierFunc

type VerifierFunc func(ctx context.Context, token string) (string, error)

VerifierFunc adapts a plain function to the Verifier interface.

func (VerifierFunc) Verify

func (f VerifierFunc) Verify(ctx context.Context, token string) (string, error)

Verify implements Verifier.

Jump to

Keyboard shortcuts

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