template

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 6 Imported by: 1 module, 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 template is an internal package that provides primitives for Caddy replacer replaced values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustReplacer

func MustReplacer(ctx context.Context) *caddy.Replacer

MustReplacer returns a caddy replacer from the context. It panics if the replacer is not found.

Types

type ExpectedAudienceError

type ExpectedAudienceError struct {
	Expected string
	Actual   []string
}

ExpectedAudienceError is returned when the audience of the ID token does not match the expected audience.

func (ExpectedAudienceError) Error

func (err ExpectedAudienceError) Error() string

type OAuth2ConfigTemplate

type OAuth2ConfigTemplate struct {
	TemplateClientID     string
	TemplateClientSecret string
	Endpoint             oauth2.Endpoint
	Scopes               []string
}

OAuth2ConfigTemplate stores a baseline oauth2.Config constructed through OIDC Discovery. Select fields are then replaced at request time with Caddy replacer values.

func (*OAuth2ConfigTemplate) ClientID

func (t *OAuth2ConfigTemplate) ClientID(repl *caddy.Replacer) (string, error)

func (*OAuth2ConfigTemplate) Replace

func (t *OAuth2ConfigTemplate) Replace(repl *caddy.Replacer) (*oauth2.Config, error)

type ReplacerTokenVerifier

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

ReplacerTokenVerifier wraps the behavior of the oidc.IDTokenVerifier so that the client ID (audience) is verified using a request-time replaced value.

func NewReplacerTokenVerifierFromProvider

func NewReplacerTokenVerifierFromProvider(clientID string, provider *oidc.Provider) *ReplacerTokenVerifier

NewReplacerTokenVerifierFromProvider returns a new ReplacerTokenVerifier from the provided oidc.Provider, configuring the verifier to skip client ID check in favor of a request-time replaced client ID.

func (*ReplacerTokenVerifier) Verify

func (t *ReplacerTokenVerifier) Verify(ctx context.Context, rawIDToken string) (*oidc.IDToken, error)

type TokenVerifier

type TokenVerifier interface {
	Verify(ctx context.Context, rawIDToken string) (*oidc.IDToken, error)
}

TokenVerifier provides a method for parsing and verifying an ID token.

Jump to

Keyboard shortcuts

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