oidc

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamServerInterceptor

func StreamServerInterceptor(t Authenticator) grpc.StreamServerInterceptor

StreamServerInterceptor returns a gRPC stream server interceptor that wraps the incoming stream with an authenticator.

func UnaryServerInterceptor

func UnaryServerInterceptor(t Authenticator) grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a gRPC unary server interceptor that performs authentication using the provided Authenticator.

Types

type Authenticator added in v0.4.6

type Authenticator interface {
	Authenticate(ctx context.Context) error
}

Authenticator - Interface for oidc authenticator

type Authn added in v0.4.6

type Authn struct {
	// IssuerURL is the URL of the OIDC issuer.
	IssuerURL string

	// Audience is the intended audience of the tokens, typically the client ID.
	Audience string

	// JwksURI is the URL to fetch the JSON Web Key Set (JWKS) from.
	JwksURI string

	// JWKs holds the JWKS fetched from JwksURI for validating tokens.
	JWKs *keyfunc.JWKS
	// contains filtered or unexported fields
}

Authn holds configuration for OIDC authentication, including issuer, audience, and key details.

func NewOidcAuthn

func NewOidcAuthn(_ context.Context, audience config.Oidc) (*Authn, error)

NewOidcAuthn creates a new instance of Authn configured for OIDC authentication. It initializes the HTTP client with retry capabilities, sets up the OIDC issuer and audience, and attempts to fetch the JWKS keys from the issuer's JWKsURI.

func (*Authn) Authenticate added in v0.4.6

func (oidc *Authn) Authenticate(requestContext context.Context) error

Authenticate validates the authentication token from the request context.

func (*Authn) Close added in v0.7.5

func (oidc *Authn) Close()

func (*Authn) GetKeys added in v0.7.5

func (oidc *Authn) GetKeys() (*keyfunc.JWKS, error)

GetKeys fetches the JSON Web Key Set (JWKS) from the configured JWKS URI.

type Config added in v0.7.5

type Config struct {
	// Issuer is the OIDC provider's unique identifier URL.
	Issuer string `json:"issuer"`
	// JWKsURI is the URL to the JSON Web Key Set (JWKS) provided by the OIDC issuer.
	JWKsURI string `json:"jwks_uri"`
}

Config holds OpenID Connect (OIDC) configuration details.

Jump to

Keyboard shortcuts

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