Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nrfcloud/api-gateway-authorizer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nrfcloud/api-gateway-authorizer - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

28

index.js

@@ -48,2 +48,19 @@ 'use strict'

const cognitoIdentities = {}
const getCognitoIdentityForToken = (token, payload) => {
const {iss, sub} = payload
if (!cognitoIdentities[sub]) {
cognitoIdentities[sub] = ci
.getId({
IdentityPoolId: process.env.identity_pool_id,
Logins: {
[iss.replace(/^https:\/\//, '')]: token
}
})
.promise()
}
return cognitoIdentities[sub]
}
exports.handler = (event, context, callback) => {

@@ -81,11 +98,4 @@ const bearerToken = event.authorizationToken

})
.then(payload => ci
.getId({
IdentityPoolId: process.env.identity_pool_id,
Logins: {
[payload.iss.replace(/^https:\/\//, '')]: token
}
})
.promise()
.then(({IdentityId}) => callback(null, {
.then(payload => getCognitoIdentityForToken(token, payload)
.then(IdentityId => callback(null, {
principalId: IdentityId,

@@ -92,0 +102,0 @@ policyDocument: {

{
"name": "@nrfcloud/api-gateway-authorizer",
"version": "1.1.0",
"version": "1.2.0",
"description": "Custom authorizer for API Gateway",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc