clauthn

package
v0.30.12 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package clauthn provides re-usable authentication (AuthN).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provide

func Provide() fx.Option

Provide the auth components as an fx dependency.

func TestProvide

func TestProvide() fx.Option

TestProvide provides authn authz dependencies that are easy to use in tests.

Types

type Authn

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

Authn provides authentication.

func NewAuthn

func NewAuthn(cfg Config, logs *zap.Logger, clock jwt.Clock) (*Authn, error)

NewAuthn inits the Authn service.

func (*Authn) AuthenticateJWT

func (a *Authn) AuthenticateJWT(ctx context.Context, inp []byte) (openid.Token, error)

AuthenticateJWT by parsing and validating the inp as a JSON web token (JWT).

func (*Authn) SignJWT

func (a *Authn) SignJWT(ctx context.Context, tok openid.Token) ([]byte, error)

SignJWT sings a JWT using the key set.

type Config

type Config struct {
	// PrivateSigningKeys will hold private keys for signing JWTs
	PubPrivKeySetB64JSON string `env:"PUB_PRIV_KEY_SET_B64_JSON" envDefault:"eyJrZXlzIjpbXX0="`
	// DefaultSignKeyID defines the default key id used for signing
	DefaultSignKeyID string `env:"DEFAULT_SIGN_KEY_ID" envDefault:"key1"`
}

Config configures the package.

Jump to

Keyboard shortcuts

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