handle

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRegisteredClaimProvided is returned when a registered claim is provided.
	ErrRegisteredClaimProvided = errors.New("registered claims should not be provided")
	// ErrJWTAlgNotFound is returned when a JWT alg is not found.
	ErrJWTAlgNotFound = errors.New("JWT alg not found")
)
View Source
var (
	// ErrToken is returned when the JWT is invalid.
	ErrToken = errors.New("JWT invalid")
)

Functions

This section is empty.

Types

type MiddlewareHook

type MiddlewareHook interface {
	Hook(options MiddlewareOptions) MiddlewareOptions
}

MiddlewareHook is a function that can be used to modify the middleware options.

type MiddlewareHookFunc

type MiddlewareHookFunc func(options MiddlewareOptions) MiddlewareOptions

MiddlewareHookFunc is a function that can be used to modify the middleware options.

func (MiddlewareHookFunc) Hook

type MiddlewareOptions

type MiddlewareOptions struct {
	Handler http.Handler
	Path    string
	Toggle  MiddlewareToggle
}

MiddlewareOptions contains options for applying middleware.

type MiddlewareToggle

type MiddlewareToggle struct {
	Admin     bool
	Authn     bool
	CommitTx  bool
	RateLimit bool
}

MiddlewareToggle contains fields to turn middleware on and off.

type Server

type Server struct {
	Config         config.Config
	Ctx            context.Context
	EmailProvider  email.Provider
	HTTPMux        *http.ServeMux
	JWKS           jwkset.Storage
	Limiter        rlimit.RateLimiter
	MagicLink      magiclink.MagicLink
	Store          storage.Storage
	Logger         *slog.Logger
	MiddlewareHook MiddlewareHook
}

Server is the magiclinksdev server.

func (*Server) HandleJWTCreate

func (*Server) HandleJWTValidate

func (*Server) HandleMagicLinkCreate added in v0.6.0

func (s *Server) HandleMagicLinkCreate(ctx context.Context, req model.ValidMagicLinkCreateRequest) (response model.MagicLinkCreateResponse, err error)

func (*Server) HandleMagicLinkEmailCreate added in v0.6.0

func (*Server) HandleOTPCreate added in v0.6.0

func (s *Server) HandleOTPCreate(ctx context.Context, req model.ValidOTPCreateRequest) (response model.OTPCreateResponse, err error)

func (*Server) HandleOTPEmailCreate added in v0.6.0

func (s *Server) HandleOTPEmailCreate(ctx context.Context, req model.ValidOTPEmailCreateRequest) (response model.OTPEmailCreateResponse, err error)

func (*Server) HandleOTPValidate added in v0.6.0

func (s *Server) HandleOTPValidate(ctx context.Context, req model.ValidOTPValidateRequest) (response model.OTPValidateResponse, err error)

func (*Server) HandleServiceAccountCreate

HandleServiceAccountCreate handles the service account creation endpoint.

Jump to

Keyboard shortcuts

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