Help us shape the future of Go! Take the 2026 Go Developer Survey

oidc

package
v0.0.26 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SelfIssuedTokenSubJwkClaimName string = "sub_jwk"
	SelfIssuedIssScheme            string = "agntcy"
)

Variables

This section is empty.

Functions

func ParseCommonName added in v0.0.21

func ParseCommonName(issuerURL string) (string, error)

func SelfIssueJWT

func SelfIssueJWT(issuer, sub string, key *jwk.Jwk) (string, error)

Types

type Authenticator

type Authenticator interface {
	Token(
		ctx context.Context,
		issuer string,
		clientID string,
		clientSecret string,
		options ...AuthenticatorTokenOption,
	) (string, error)
}

func NewAuthenticator

func NewAuthenticator() Authenticator

type AuthenticatorTokenOption added in v0.0.22

type AuthenticatorTokenOption func(config *clientcredentials.Config)

func WithScopes added in v0.0.22

func WithScopes(scopes []string) AuthenticatorTokenOption

type CachedJwks

type CachedJwks struct {
	Jwks string
}

type Claims

type Claims struct {
	Issuer  string `json:"iss"`
	Subject string `json:"sub"`
	SubJWK  string `json:"sub_jwk"` // used for self-issued tokens
}

type ParsedJWT

type ParsedJWT struct {
	Claims     *Claims
	Provider   ProviderName
	CommonName string
	// contains filtered or unexported fields
}

type Parser

type Parser interface {
	// VerifyJwt verifies the provided JWT signature.
	// If the JWT is not self-issued (provider = SelfProviderName) it will validate
	// the token using the public key located in the claims (sub_jwk).
	// Else, it will attempt to retrieve the JWKS from the issuer's metadata.
	VerifyJwt(ctx context.Context, jwt *ParsedJWT) error

	// Get the parsed JWT including the issuer, the subject claims
	// the common name and the provider metadata
	ParseJwt(ctx context.Context, jwtString *string) (*ParsedJWT, error)
}

The Parser defines different methods for the PARSER standard

func NewParser

func NewParser() Parser

NewParser creates a new instance of the Parser

type ProviderName

type ProviderName int
const (
	UnknownProviderName ProviderName = iota
	OktaProviderName
	DuoProviderName
	OryProviderName
	IdpProviderName
	PingProviderName
	EntraProviderName
	SelfProviderName
)

Jump to

Keyboard shortcuts

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