serverless-offline
serverless-offline copied to clipboard
Cannot use basic http authorizer with httpApi
https://github.com/dherault/serverless-offline/blob/0f7ec23c0995efc9a74928ce40194cf6b06a6c66/src/events/http/HttpServer.js#L308
This should be
if (!jwtSettings.authorizerName) {
return null;
}
so _configureAuthorization can be use instead of _configureJWTAuthorization.
Reproducer:
service: myservice
frameworkVersion: '3'
provider:
name: aws
runtime: nodejs14.x
profile: default
httpApi:
authorizers:
customAuthorizer:
type: request
functionName: customAuthorizer
resultTtlInSeconds: 0
identitySource: method.request.header.Authorization
functions:
api:
handler: handler.handler
environment:
AWS_SDK_LOAD_CONFIG: 1
events:
- httpApi:
path: "/{path+}"
method: "*"
authorizer:
name: customAuthorizer
type: request
customAuthorizer:
handler: authorizer.handler
resources:
Resources:
GatewayResponse:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.WWW-Authenticate: "'Basic'"
ResponseType: UNAUTHORIZED
RestApiId:
Ref: 'ApiGatewayRestApi'
StatusCode: '401'
plugins:
- serverless-offline
#1311 related