sls-helper-plugin-janis
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -9,2 +9,10 @@ # Changelog | ||
## [2.2.0] - 2020-02-18 | ||
### Added | ||
- Custom authorizer support added in event listeners | ||
- Custom authorizers can now be defined in `custom.authorizers` object in initial config and they will be remain untouched | ||
### Fixed | ||
- Authorizers now use the correct ARN | ||
## [2.1.0] - 2020-02-14 | ||
@@ -11,0 +19,0 @@ ### Added |
@@ -15,3 +15,4 @@ 'use strict'; | ||
mustHaveClient, | ||
listenersDirName | ||
listenersDirName, | ||
authorizer | ||
}) => { | ||
@@ -28,3 +29,3 @@ | ||
const authorizer = mustHaveClient ? 'ServiceAuthorizer' : 'ServiceNoClientAuthorizer'; | ||
const authorizerName = authorizer || (mustHaveClient ? 'ServiceAuthorizer' : 'ServiceNoClientAuthorizer'); | ||
@@ -43,3 +44,3 @@ const listenerName = `${serviceNameAsTitle}${entityNameAsTitle}${eventNameAsTitle}Listener`.replace(/ /g, ''); | ||
method: 'post', | ||
authorizer: `\${self:custom.authorizers.${authorizer}}`, | ||
authorizer: `\${self:custom.authorizers.${authorizerName}}`, | ||
request: { | ||
@@ -46,0 +47,0 @@ template: '${self:custom.apiRequestTemplate}' |
@@ -51,3 +51,3 @@ 'use strict'; | ||
name, | ||
arn: `arn:aws:lambda:us-east-1:${accountId}:function:JanisIdService-\${self:custom.stage}-${authorizersNameToFunctionMapping[name] || name}`, | ||
arn: `arn:aws:lambda:us-east-1:${accountId}:function:JanisAuthorizerService-\${self:custom.stage}-${authorizersNameToFunctionMapping[name] || name}`, | ||
resultTtlInSeconds: 300, | ||
@@ -72,2 +72,4 @@ identitySource: headers.map(header => `method.request.header.${header}`).join(','), | ||
const authorizers = (custom && custom.authorizers) || {}; | ||
return { | ||
@@ -77,5 +79,8 @@ ...serviceConfig, | ||
...(custom || {}), | ||
authorizers: buildAuthorizers(accountId) | ||
authorizers: { | ||
...authorizers, | ||
...buildAuthorizers(accountId) | ||
} | ||
} | ||
}; | ||
}; |
{ | ||
"name": "sls-helper-plugin-janis", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "A Serverless Helper plugin to add custom helpers for JANIS Commerce", | ||
@@ -5,0 +5,0 @@ "main": "lib/plugin.js", |
@@ -84,3 +84,3 @@ # Serverless Helper Plugin JANIS | ||
| requestHeaders | object | A key value to map headers to a boolean indicating if it's required or not | | | | ||
| authorizer | string | The name of the authorizer | Valid authorizers: FullAuthorizer, NoClientAuthorizer, LoggedAuthorizer, ApiKeyAuthorizer, UserAuthorizer, DevUserAuthorizer, ServiceAuthorizer, ServiceNoClientAuthorizer, ClientAuthorizer | | | ||
| authorizer | string | The name of the authorizer | | | | ||
@@ -100,3 +100,3 @@ ### apiList, apiGet, apiPost and apiPut | ||
| requestHeaders | object | A key value to map headers to a boolean indicating if it's required or not | | | | ||
| authorizer | string | The name of the authorizer | Valid authorizers: FullAuthorizer, NoClientAuthorizer, LoggedAuthorizer, ApiKeyAuthorizer, UserAuthorizer, DevUserAuthorizer, ServiceAuthorizer, ServiceNoClientAuthorizer, ClientAuthorizer | | | ||
| authorizer | string | The name of the authorizer | | | | ||
@@ -114,2 +114,3 @@ ### eventListener | ||
| listenersDirName | string | Indicates the path where the event listener files are placed | | `'event-listeners'` | | ||
| authorizer | string | The name of the authorizer | | If not set, it defaults to `ServiceAuthorizer` or `ServiceNoClientAuthorizer` based on the value of `mustHaveClient` | | ||
@@ -116,0 +117,0 @@ ## Examples |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33957
789
185