Documentation
¶
Index ¶
- Variables
- func Authorization(req Request) (scheme, credentials string, ok bool)
- func BasicCredentials(req Request) (user, password string, ok bool)
- func Bearer(req Request) (string, bool)
- func Header(req Request, name string) (string, bool)
- func Query(req Request, name string) (string, bool)
- type Basic
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
var (
ErrForbidden = errors.New("forbidden")
)
Functions ¶
func Authorization ¶ added in v0.14.0
Authorization returns the scheme and credentials of Authorization header. The scheme is case-insensitive, it is returned as given by the client.
func BasicCredentials ¶ added in v0.14.0
BasicCredentials returns user and password of Authorization: Basic <base64> header. Both padded (RFC 7617) and unpadded base64 are accepted.
Types ¶
type Basic ¶
type Basic struct {
// contains filtered or unexported fields
}
Basic Authorizer implements simple access/secret key validation.
type Request ¶ added in v0.14.0
type Request = events.APIGatewayV2CustomAuthorizerV2Request
Request is the event received by Lambda authorizer of HTTP API configured with SIMPLE response type (authorizer payload format 2.0), which is the default of scud.Gateway.NewAuthorizerLambda.
lambda.Start(func(req authorizer.Request) (authorizer.Response, error) {
key, ok := authorizer.Bearer(req)
if !ok {
return authorizer.Deny(), nil
}
...
return authorizer.Allow(map[string]any{"sub": "..."}), nil
})
The context of the response is delivered to the integration at requestContext.authorizer (integration payload format 1.0) or at requestContext.authorizer.lambda (integration payload format 2.0).