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

@outlinerisk/auth0-tools

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@outlinerisk/auth0-tools - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

6

dist/management/clients/appClient.js

@@ -105,2 +105,8 @@ import { logger } from '../../logger.js';

}
// check if grant already exists
const grants = await this.getAppGrantsByName(appName, apiName);
if (grants.length > 0) {
logger.info(`M2M app with name '${appName}' is already authorized on API with name: '${apiName}', exiting.`);
return;
}
// authorize m2m app on api

@@ -107,0 +113,0 @@ let apiScopes = [];

10

dist/management/clients/managementClient.d.ts

@@ -1,2 +0,2 @@

import { Client, ManagementClient, ResourceServer } from 'auth0';
import { Client, ClientGrant, ManagementClient, ResourceServer } from 'auth0';
/**

@@ -12,2 +12,3 @@ * Pathpoint's Auth0 client that wraps Auth0's ManagementClient.

apiManager: any;
m2mGrantsManager: any;
prefix: string;

@@ -68,2 +69,9 @@ /**

/**
* Retrieves the grants for the given M2M app on the given API.
*
* @param appName The human readable name of the M2M app.
* @param apiName The human readable name of the API.
*/
getAppGrantsByName: (appName: string, apiName?: string) => Promise<ClientGrant[]>;
/**
* Retrieves the API(s) with the given name.

@@ -70,0 +78,0 @@ * Returns an array because it's possible to have multiple APIs with the same name,

@@ -14,2 +14,3 @@ import { ManagementClient } from 'auth0';

apiManager;
m2mGrantsManager;
prefix;

@@ -38,2 +39,4 @@ /**

this.appManager = this.managementClient.clients;
// @ts-ignore - auth0 doesn't provide types for their managers
this.m2mGrantsManager = this.managementClient.clientGrants;
this.prefix = prefix;

@@ -171,2 +174,46 @@ }

/**
* Retrieves the grants for the given M2M app on the given API.
*
* @param appName The human readable name of the M2M app.
* @param apiName The human readable name of the API.
*/
getAppGrantsByName = async (appName, apiName = '') => {
let grants = [];
fetchAppGrants: try {
const app = await this.getAppByName(appName);
if (!app) {
break fetchAppGrants;
}
// set up base params
const perPage = 50;
let params = {
client_id: app.client_id,
include_totals: true,
page: 0,
per_page: perPage,
};
// check for api
const api = await this.getAPIByName(apiName);
if (api) {
params['audience'] = api.identifier;
}
// get first page
let res = await this.m2mGrantsManager.getAll(params);
grants = res.client_grants;
// iterate through remaining pages
const total = res.total;
for (let page = 1; page * perPage < total; page++) {
// get page
params['page'] = page;
res = await this.m2mGrantsManager.getAll(params);
grants = grants.concat(res.client_grants);
}
}
catch (err) {
logger.error(`Error while trying to get grants for M2M app with name: '${appName}' on API with name: '${apiName}'.\n${err}`);
throw err;
}
return grants;
};
/**
* Retrieves the API(s) with the given name.

@@ -173,0 +220,0 @@ * Returns an array because it's possible to have multiple APIs with the same name,

2

package.json
{
"name": "@outlinerisk/auth0-tools",
"version": "0.1.13",
"version": "0.1.14",
"description": "Pathpoint's internal Auth0 tooling.",

@@ -5,0 +5,0 @@ "author": "Pathpoint",

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