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 Heimdallr ¶
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.
Types ¶
type Identity ¶
type Identity struct {
Namespace uuid.UUID
PublicKey *ecdsa.PublicKey
SourceIp string
UserAgent string
}
func FromContext ¶
FromContext returns an Identity from the request context. If the request context does not contain an AuthorizedRequestContext, the second return value is false.
func MustFromContext ¶
MustFromContext is like FromContext but panics if the request context does not contain an AuthorizedRequestContext.