If I'd like to define my API-Gateway through an 'implicit way', i.e., by defining the Lambda function and its associated Events-->ApiEventSource. See an example below.
Could I define the custom authorizer in this way? If so, how?
(Here is an example copied&pasted from https://github.com/awslabs/serverless-application-model/issues/104)
Resources:
Create:
Type: AWS::Serverless::Function
Properties:
Handler: meta/create.create
CodeUri: app/
Runtime: nodejs4.3
Policies: AWSLambdaBasicExecutionRole
Environment:
Variables:
DYNAMODB_TABLE_ENV: !Sub '${ServiceName}-${Stage}'
Events:
ApiEventSource:
Type: Api
Properties:
Path: /
Method: POST
Delete:
Type: AWS::Serverless::Function
Properties:
Handler: meta/delete.delete
CodeUri: app/
Runtime: nodejs4.3
Policies: AWSLambdaBasicExecutionRole
Environment:
Variables:
DYNAMODB_TABLE_ENV: !Sub '${ServiceName}-${Stage}'
Events:
ApiEventSource:
Type: Api
Properties:
Path: /meta/{metaId}
Method: DELETE
@syang "Implicit way" doesn't support that, you have to use AWS::Serverless::Api and define custom authorizers in swagger. Remember that for API event source in Lambda:
If an AWS::Serverless::Api resource is defined, the path and method values MUST correspond to an operation in the Swagger definition of the API.
I'll mark this as a feature request, because custom authorizers are a great thing to have in general. We'lll get this prioritiezed
Its happening #248!
Most helpful comment
I'll mark this as a feature request, because custom authorizers are a great thing to have in general. We'lll get this prioritiezed