auth

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 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 provides JWT verification with JWKS caching for the LFX MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractScopes

func ExtractScopes(token jwt.Token) []string

ExtractScopes extracts scopes from a JWT token. Handles both "scope" (space-separated string) and "scopes" (array) claims.

Types

type JWTVerifier

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

JWTVerifier verifies JWT tokens using cached JWKS from authorization servers.

func NewJWTVerifier

func NewJWTVerifier(cfg JWTVerifierConfig) (*JWTVerifier, error)

NewJWTVerifier creates a new JWT verifier with JWKS caching.

func (*JWTVerifier) VerifyToken

func (v *JWTVerifier) VerifyToken(ctx context.Context, tokenString string) (jwt.Token, error)

VerifyToken verifies a JWT token and returns the parsed token.

type JWTVerifierConfig

type JWTVerifierConfig struct {
	// AuthServers is the list of authorization server URLs (e.g., ["https://example.auth0.com"]).
	// JWKS will be fetched from {authServer}/.well-known/jwks.json for each server.
	AuthServers []string

	// Audience is the expected audience claim (aud) in the JWT.
	Audience string

	// HTTPClient is the HTTP client to use for fetching JWKS.
	// If nil, a default client with 30s timeout will be created.
	HTTPClient *http.Client

	// CacheRefreshInterval is how often to refresh the JWKS cache.
	// If zero, defaults to 15 minutes.
	CacheRefreshInterval time.Duration
}

JWTVerifierConfig holds configuration for JWT verification.

Jump to

Keyboard shortcuts

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