New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@frontegg/client

Package Overview
Dependencies
Maintainers
1
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontegg/client - npm Package Compare versions

Comparing version 1.2.8 to 1.2.9

dist/src/utils/getPackageJSON.d.ts

2

dist/src/identity/contextResolver.js

@@ -14,3 +14,3 @@ "use strict";

tenantId: req.user.tenantId,
userId: req.user.sub,
userId: req.user.id,
permissions: [index_1.FronteggPermissions.All],

@@ -17,0 +17,0 @@ };

@@ -5,2 +5,22 @@ export interface IWithAuthenticationOptions {

}
export declare enum tokenTypes {
UserApiToken = "userApiToken",
TenantApiToken = "tenantApiToken",
UserToken = "userToken"
}
export interface IUser {
sub: string;
tenantId: string;
roles: string[];
permissions: string[];
metadata: Record<string, any>;
createdByUserId: string;
type: tokenTypes;
name?: string;
email?: string;
email_verified?: boolean;
invisible?: true;
tenantIds?: string[];
profilePictureUrl?: string;
}
export declare function withAuthentication({ roles, permissions }?: IWithAuthenticationOptions): (req: any, res: any, next: any) => Promise<any>;

@@ -40,2 +40,8 @@ "use strict";

var identity_client_1 = require("./identity-client");
var tokenTypes;
(function (tokenTypes) {
tokenTypes["UserApiToken"] = "userApiToken";
tokenTypes["TenantApiToken"] = "tenantApiToken";
tokenTypes["UserToken"] = "userToken";
})(tokenTypes = exports.tokenTypes || (exports.tokenTypes = {}));
function withAuthentication(_a) {

@@ -57,3 +63,4 @@ var _this = this;

publicKey = _a.sent();
jsonwebtoken_1.verify(token, publicKey, { algorithms: ['RS256'] }, function (err, user) {
jsonwebtoken_1.verify(token, publicKey, { algorithms: ['RS256'] }, function (err, decoded) {
var user = decoded;
if (err) {

@@ -93,3 +100,11 @@ res.status(401).send('Authentication failed');

req.user = user;
req.user.id = user.sub; // The subject of the token (OpenID token) is saved on the req.user as well for easier readability
req.user.id = '';
switch (req.user.type) {
case tokenTypes.UserToken:
req.user.id = user.sub; // The subject of the token (OpenID token) is saved on the req.user as well for easier readability
break;
case tokenTypes.UserApiToken:
req.user.id = user.createdByUserId;
break;
}
// And move to the next handler

@@ -96,0 +111,0 @@ next();

@@ -44,4 +44,6 @@ "use strict";

var utils_1 = require("./utils");
var getPackageJSON_1 = require("../utils/getPackageJSON");
var proxy = httpProxy.createProxyServer({ secure: false, changeOrigin: true });
var target = process.env.FRONTEGG_API_GATEWAY_URL || 'https://api.frontegg.com/';
var pjson = getPackageJSON_1.getPackageJson() || { version: 'unknown' };
var authenticator = new authenticator_1.FronteggAuthenticator();

@@ -61,5 +63,6 @@ var MAX_RETRIES = 3;

'x-access-token': authenticator.accessToken,
'frontegg-tenant-id': context && context.tenantId ? context.tenantId : '',
'frontegg-tenant-id': context && context.tenantId ? context.tenantId : 'WITHOUT_TENANT_ID',
'frontegg-user-id': context && context.userId ? context.userId : '',
'frontegg-vendor-host': req.hostname,
'frontegg-middleware-client': "Node.js@" + pjson.version
},

@@ -66,0 +69,0 @@ })];

{
"name": "@frontegg/client",
"version": "1.2.8",
"version": "1.2.9",
"description": "Frontegg Javascript Library for backend",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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