oidc

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 15 Imported by: ? 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 oidc authenticates a request by a signed OIDC JWT from any issuer, and maps a claim of the JWT to a scope on a repository with rules. An identity-aware proxy that signs a JWT with a key set is one configuration of it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Issuer is the exact value of the iss claim.
	Issuer string
	// Audience must be one of the aud claims.
	Audience string
	// KeysURL is the address of the key set. When it is empty, the key set is the jwks_uri of the discovery
	// document at <Issuer>/.well-known/openid-configuration.
	KeysURL string
	// Header names the header that carries the JWT. Default Authorization, as a Bearer token or the password of a
	// Basic credential. Any other header carries the bare JWT.
	Header string
	// Claim names the claim that holds the subject text that the rules match. Default email.
	Claim string
	// Algs lists the accepted signature algorithms: RS256, RS384, RS512, ES256 or ES384. Default RS256.
	Algs   []string
	Client *http.Client
	Now    func() time.Time
}

Config is the deployment of one issuer.

type Verifier

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

Verifier verifies the JWT.

func New

func New(cfg Config) (*Verifier, error)

New checks cfg.

func (*Verifier) Verify

func (a *Verifier) Verify(r *http.Request) (identity.Principal, error)

Verify checks the JWT of r. The subject is the claim that cfg.Claim names. A claim email is the email of the principal, and the principal has a verified email only when that claim is the subject.

Jump to

Keyboard shortcuts

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