asgard

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package asgard provides middleware for use in HTTP API servers. In Norse mythology, Heimdallr is the gatekeeper of Bifröst.

Heimdallr returna a HTTP Handler middleware function that parses a header for authentication information. On success, it stores an Identity in the request context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientCert added in v1.16.0

func ClientCert(ctx context.Context) (*bifrost.Certificate, bool)

ClientCert returns the client certificate from the request context. If the client certificate is not present, the second return value is false. Use this function to access the client certificate in a HTTP handler that has been wrapped with Heimdallr.

func Heimdallr

func Heimdallr(h HeaderName, ns uuid.UUID) func(http.Handler) http.Handler

Heimdallr returns a HTTP Handler middleware function that parses an AuthorizedRequestContext from the request context header. If namespace does not match the parsed one, the request is forbidden. The AuthorizedRequestContext is stored in the request context.

If Heimdallr is used in an AWS Lambda Web Adapter powered API server, Bouncer Lambda Authorizer must be configured as an authorizer for the API Gateway method.

func Hofund added in v1.16.0

func Hofund(h HeaderName, ns uuid.UUID) func(http.Handler) http.Handler

Types

type HeaderName added in v1.16.0

type HeaderName int
const (
	HeaderNameClientCertLeaf HeaderName = iota // X-Amzn-Mtls-Clientcert-Leaf
	HeaderNameClientCert                       // X-Amzn-Mtls-Clientcert
)

func (HeaderName) String added in v1.16.0

func (i HeaderName) String() string

Jump to

Keyboard shortcuts

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