handle

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 20 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

Hook implements the MiddlewareHook interface.

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

Server is the magiclinksdev server.

func (*Server) HandleEmailLinkCreate

HandleEmailLinkCreate handles the email link creation endpoint.

func (*Server) HandleJWTCreate

HandleJWTCreate handles the creation of a JWT.

func (*Server) HandleJWTValidate

HandleJWTValidate handles the JWT validation endpoint.

func (*Server) HandleLinkCreate

func (s *Server) HandleLinkCreate(ctx context.Context, req model.ValidLinkCreateRequest) (response model.LinkCreateResponse, err error)

HandleLinkCreate handles the link creation endpoint.

func (*Server) HandleServiceAccountCreate

HandleServiceAccountCreate handles the service account creation endpoint.

type SigningBytesClaims

type SigningBytesClaims struct {
	Claims json.RawMessage
}

SigningBytesClaims is a JWT claims type that allows for signing claims represented in bytes.

func (SigningBytesClaims) MarshalJSON

func (s SigningBytesClaims) MarshalJSON() ([]byte, error)

MarshalJSON helps implement the json.Marshaler interface.

func (SigningBytesClaims) Valid

func (s SigningBytesClaims) Valid() error

Valid helps implement the jwt.Claims interface.

Jump to

Keyboard shortcuts

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