oidc

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 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 {
	// URL of the issuer. This is typically the base URL of the identity provider.
	IssuerURL string
	// Audience for which the token is intended. It must match the audience in the JWT.
	Audience string
	// URL of the JSON Web Key Set (JWKS). This URL hosts public keys used to verify JWT signatures.
	JwksURI string
	// contains filtered or unexported fields
}

func NewOidcAuthn

func NewOidcAuthn(ctx context.Context, conf config.Oidc) (*Authn, error)

NewOidcAuthn initializes a new instance of the Authn struct with OpenID Connect (OIDC) configuration. It takes in a context for managing cancellation and a configuration object. It returns a pointer to an Authn instance or an error.

func (*Authn) Authenticate added in v0.4.6

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

Authenticate validates the JWT token found in the authorization header of the incoming request. It uses the OIDC configuration to validate the token against the issuer's public keys.

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.

type OIDCSlogAdapter added in v0.7.9

type OIDCSlogAdapter struct {
	Logger *slog.Logger
}

OIDCSlogAdapter adapts the slog.Logger to be compatible with retryablehttp.LeveledLogger.

func (OIDCSlogAdapter) Debug added in v0.7.9

func (a OIDCSlogAdapter) Debug(msg string, keysAndValues ...interface{})

Debug logs messages at debug level.

func (OIDCSlogAdapter) Error added in v0.7.9

func (a OIDCSlogAdapter) Error(msg string, keysAndValues ...interface{})

Error logs messages at error level.

func (OIDCSlogAdapter) Info added in v0.7.9

func (a OIDCSlogAdapter) Info(msg string, keysAndValues ...interface{})

Info logs messages at info level.

func (OIDCSlogAdapter) Warn added in v0.7.9

func (a OIDCSlogAdapter) Warn(msg string, keysAndValues ...interface{})

Warn logs messages at warn level.

Jump to

Keyboard shortcuts

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