Move `http` event authorizer settings to top level `provider` section
#2,887 创建于 2016年12月7日
描述
Currently, the settings for a custom authorizer function are set within the event settings for each function:
functions:
newFunction:
handler: function.handler
events:
- http:
path: url/path
method: get
authorizer:
name: customAuth
resultTtlInSeconds: 30
identityValidationExpression: .*
customAuth:
handler: auth.handler
memorySize: 128
This leaves room for those settings to be redefined multiple times in the configuration, and can introduce uncertainty, particularly when there are multiple hands touching the code.
It would be beneficial to have everything related to the custom authorizer in one spot, and just reference the authorizer by name in each function. Something like this:
functions:
newFunction:
handler: function.handler
events:
- http:
path: url/path
method: get
authorizer: customAuth
customAuth:
handler: auth.handler
memorySize: 128
authorizerSettings:
resultTtlInSeconds: 30
identityValidationExpression: .*
Implementation proposal
Introduce similar authorizer configuration as it's for httpApi events. Individual authorizers should be configured at provider.apiGateway.authorizer settings and which are referenced at http events.
This new setup should be introduced in non breaking way, but with configured deprecation of authorizer configurations at http event level