oidc

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

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,
	) (string, error)
}

func NewAuthenticator

func NewAuthenticator() Authenticator

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
	SelfProviderName
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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