Documentation ¶
Overview ¶
Package middleware defines HTTP middleware such as those used for user validation.
Index ¶
Constants ¶
const ( APIAuthTypeValue = "API" DeviceAuthTypeValue = "DEVICE" AuthTypeHeader = "X-FREYR-AUTHTYPE" TokenHeader = "X-FREYR-TOKEN" AuthUserHeader = "X-FREYR-USER" APIAuthDateHeader = "X-FREYR-DATETIME" APISignatureHeader = "X-FREYR-SIGNATURE" )
Constant definitions for authorization type headers and header values.
Variables ¶
This section is empty.
Functions ¶
func Authorize ¶
func Authorize(auths ...Authorizer) apollo.Constructor
Authorize returns a piece of middleware that will verify if the request is authorized by and of the Authorizers passed in before calling subsequent handlers.
Types ¶
type APIAuthorizer ¶
type APIAuthorizer struct {
// contains filtered or unexported fields
}
APIAuthorizer is a type used to validate requests were signed in the manner expected of API style requests.
func NewAPIAuthorizer ¶
func NewAPIAuthorizer(ss models.SecretStore) *APIAuthorizer
NewAPIAuthorizer returns a new APIAuthorizer
type Authorizer ¶
Authorizer is an interface that represents types capable of validating if an HTTP request is authorized, and returning a context indicating the authorized user
type DeviceAuthorizer ¶
type DeviceAuthorizer struct {
// contains filtered or unexported fields
}
DeviceAuthorizer is a type used to verify that a request was signed in the manner specified for requests from a device.
func NewDeviceAuthorizer ¶
func NewDeviceAuthorizer(ss models.SecretStore) *DeviceAuthorizer
NewDeviceAuthorizer returns a new *DeviceAuthorizer
type WebAuthorizer ¶
type WebAuthorizer struct {
// contains filtered or unexported fields
}
WebAuthorizer is used to verify if requests are signed in a manner expected users accessing the api via a web browser.
func NewWebAuthorizer ¶
func NewWebAuthorizer(tS token.JWTTokenGen) *WebAuthorizer
NewWebAuthorizer generates a new *WebAuthorizer