forked from serverless/serverless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
authorizers.js
31 lines (27 loc) · 854 Bytes
/
authorizers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
const _ = require('lodash');
module.exports = {
compileAuthorizers() {
this.validated.events.forEach((event) => {
if (!event.authorizer) {
return;
}
const websocketsAuthorizerLogicalId = this.provider.naming.getWebsocketsAuthorizerLogicalId(
event.authorizer.name
);
_.merge(this.serverless.service.provider.compiledCloudFormationTemplate.Resources, {
[websocketsAuthorizerLogicalId]: {
Type: 'AWS::ApiGatewayV2::Authorizer',
Properties: {
ApiId: this.provider.getApiGatewayWebsocketApiId(),
Name: event.authorizer.name,
AuthorizerType: 'REQUEST',
AuthorizerUri: event.authorizer.uri,
IdentitySource: event.authorizer.identitySource,
},
},
});
});
return;
},
};