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

@inrupt/generate-oidc-token

Package Overview
Dependencies
Maintainers
10
Versions
299
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inrupt/generate-oidc-token - npm Package Compare versions

Comparing version 0.0.1-featstatic-registration-430797298-29-1608306301.0 to 0.0.1-featstatic-registration-431034973-30-1608314129.0

6

dist/constants.js

@@ -23,4 +23,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.IDP_POD_COMPAT = exports.IDP_POD_INRUPT = void 0;
exports.IDP_POD_INRUPT = "https://broker.pod.inrupt.com";
exports.IDP_POD_COMPAT = "https://broker.pod-compat.inrupt.com";
exports.IDENTITY_PROVIDER_INRUPT_PROD_COMPAT = exports.IDENTITY_PROVIDER_INRUPT_PROD = void 0;
exports.IDENTITY_PROVIDER_INRUPT_PROD = "https://broker.pod.inrupt.com";
exports.IDENTITY_PROVIDER_INRUPT_PROD_COMPAT = "https://broker.pod-compat.inrupt.com";

@@ -36,13 +36,13 @@ "use strict";

.alias("idp", "solidIdentityProvider")
.describe("appName", "The name of the app you are registering.")
.describe("applicationName", "The name of the client application you whish to register.")
.describe("registration", "[static] if you want to manually register the client, [dynamic] otherwise.")
.describe("port", "The port number on which the identity provider will return the token.")
.describe("port", "@inrupt/generate-oidc-token will start a local web server, in order for the Solid Identity Provider to redirect the user back after they log in. This is the port number to which this local server will be bound.")
.locale("en")
.help().argv;
const inputOptions = Object.assign(Object.assign({}, argv), { clientName: argv.appName });
const inputOptions = Object.assign(Object.assign({}, argv), { clientName: argv.applicationName });
// Complete CLI arguments with user prompt
const validatedOptions = {
solidIdentityProvider: (_a = inputOptions.solidIdentityProvider) !== null && _a !== void 0 ? _a : (await prompts_1.promptIdp()),
registrationType: (_b = inputOptions.registrationType) !== null && _b !== void 0 ? _b : (await prompts_1.promptRegistration()),
clientName: (_c = inputOptions.clientName) !== null && _c !== void 0 ? _c : (await prompts_1.promptClientName()),
solidIdentityProvider: (_a = inputOptions.solidIdentityProvider) !== null && _a !== void 0 ? _a : (await prompts_1.promptSolidIdentityProvider()),
registrationType: (_b = inputOptions.registrationType) !== null && _b !== void 0 ? _b : (await prompts_1.promptRegistrationType()),
applicationName: (_c = inputOptions.applicationName) !== null && _c !== void 0 ? _c : (await prompts_1.promptApplicationName()),
};

@@ -60,3 +60,3 @@ const port = (_d = argv.port) !== null && _d !== void 0 ? _d : (await prompts_1.promptPort());

const loginOptions = {
clientName: validatedOptions.clientName,
clientName: validatedOptions.applicationName,
oidcIssuer: validatedOptions.solidIdentityProvider,

@@ -71,4 +71,4 @@ redirectUrl: iriBase,

if (validatedOptions.registrationType === "static") {
console.log(`Please go perform the static registration of your application to [${validatedOptions.solidIdentityProvider}].`);
console.log(`The redirect IRI will be ${iriBase}`);
console.log(`Please perform static registration of your application at the Solid Identity Provider [${validatedOptions.solidIdentityProvider}].`);
console.log(`The redirect IRI will be [${iriBase}] (you will need this information when registering your application).`);
console.log("At the end of the registration process, you should get a client ID and secret.");

@@ -79,5 +79,5 @@ clientInfo = await prompts_1.promptStaticClientInfo();

}
console.log(`Logging in ${validatedOptions.solidIdentityProvider} to get a refresh token.`);
console.log(`Logging into Solid Identity Provider ${validatedOptions.solidIdentityProvider} to get a refresh token.`);
session.login(loginOptions).catch((e) => {
throw new Error(`Login failed: ${e.toString()}`);
throw new Error(`Logging into Solid Identity Provider [${validatedOptions.solidIdentityProvider}] failed: ${e.toString()}`);
});

@@ -99,3 +99,3 @@ });

console.log(`Client Secret: [${storedSession.clientSecret}]`);
res.send("The tokens have been sent to the bootstraping app. You can close this window.");
res.send("The tokens have been sent to @inrupt/generate-oidc-token. You can close this window.");
server.close();

@@ -102,0 +102,0 @@ });

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.promptStaticClientInfo = exports.promptPort = exports.promptClientName = exports.promptRegistration = exports.promptIdp = void 0;
exports.promptStaticClientInfo = exports.promptPort = exports.promptApplicationName = exports.promptRegistrationType = exports.promptSolidIdentityProvider = void 0;
const constants_1 = require("./constants");

@@ -35,6 +35,6 @@ const inquirer_1 = __importDefault(require("inquirer"));

choices: [
{ name: constants_1.IDP_POD_INRUPT },
{ name: constants_1.IDP_POD_COMPAT },
{ name: constants_1.IDENTITY_PROVIDER_INRUPT_PROD },
{ name: constants_1.IDENTITY_PROVIDER_INRUPT_PROD_COMPAT },
{
name: "My Solid Identity provider is not on the list.",
name: "My Solid Identity provider is not on the list - please contact 'developer-support@inrupt.com' if you'd like to discuss adding a new provider.",
value: undefined,

@@ -46,7 +46,7 @@ },

type: "input",
message: "What is the URL of the Solid Identity Provider you want to register your app to?",
message: "What is the URL of the Solid Identity Provider you wish to register your application with?",
name: "solidIdentityProvider",
default: "",
};
async function promptIdp() {
async function promptSolidIdentityProvider() {
let { identityProvider: solidIdentityProvider } = await inquirer_1.default.prompt([

@@ -61,3 +61,3 @@ PROMPT_IDP_LIST,

}
exports.promptIdp = promptIdp;
exports.promptSolidIdentityProvider = promptSolidIdentityProvider;
const PROMPT_REGISTRATION_TYPE = {

@@ -79,15 +79,15 @@ type: "list",

};
const promptRegistration = async () => (await inquirer_1.default.prompt([PROMPT_REGISTRATION_TYPE])).registrationType;
exports.promptRegistration = promptRegistration;
const promptRegistrationType = async () => (await inquirer_1.default.prompt([PROMPT_REGISTRATION_TYPE])).registrationType;
exports.promptRegistrationType = promptRegistrationType;
const PROMPT_CLIENT_NAME = {
type: "input",
message: "What is the name of the app you are registering?",
message: "What is the name of the application you are registering?",
name: "clientName",
default: undefined,
};
const promptClientName = async () => (await inquirer_1.default.prompt([PROMPT_CLIENT_NAME])).clientName;
exports.promptClientName = promptClientName;
const promptApplicationName = async () => (await inquirer_1.default.prompt([PROMPT_CLIENT_NAME])).clientName;
exports.promptApplicationName = promptApplicationName;
const PROMPT_PORT = {
type: "number",
message: "On what port should the identity provider return the token?",
message: "@inrupt/generate-oidc-token will start a local web server, in order for the Solid Identity Provider to redirect the user back after they log in. To what port should this local server be bound?",
name: "port",

@@ -97,3 +97,3 @@ default: 3001,

if (!input || input < 0 || input >= 65536) {
return `The port must be a number in the [0;65536[ range, received [${input}].`;
return `The port must be a number between 0 and 65536, we received [${input}].`;
}

@@ -100,0 +100,0 @@ return true;

{
"name": "@inrupt/generate-oidc-token",
"version": "0.0.1-featstatic-registration-430797298-29-1608306301.0",
"version": "0.0.1-featstatic-registration-431034973-30-1608314129.0",
"description": "A small app to help scripts access private resources on Solid Pods",

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

@@ -22,3 +22,4 @@ /**

export const IDP_POD_INRUPT = "https://broker.pod.inrupt.com";
export const IDP_POD_COMPAT = "https://broker.pod-compat.inrupt.com";
export const IDENTITY_PROVIDER_INRUPT_PROD = "https://broker.pod.inrupt.com";
export const IDENTITY_PROVIDER_INRUPT_PROD_COMPAT =
"https://broker.pod-compat.inrupt.com";

@@ -31,6 +31,6 @@ /**

import {
promptClientName,
promptIdp,
promptApplicationName,
promptSolidIdentityProvider,
promptPort,
promptRegistration,
promptRegistrationType,
promptStaticClientInfo,

@@ -41,3 +41,3 @@ } from "./prompts";

solidIdentityProvider?: string;
clientName?: string;
applicationName?: string;
registrationType?: "static" | "dynamic";

@@ -48,4 +48,4 @@ };

solidIdentityProvider: string;
applicationName?: string;
registrationType: "static" | "dynamic";
clientName?: string;
};

@@ -61,4 +61,7 @@

.alias("idp", "solidIdentityProvider")
.describe("appName", "The name of the app you are registering.")
.describe(
"applicationName",
"The name of the client application you whish to register."
)
.describe(
"registration",

@@ -69,3 +72,3 @@ "[static] if you want to manually register the client, [dynamic] otherwise."

"port",
"The port number on which the identity provider will return the token."
"@inrupt/generate-oidc-token will start a local web server, in order for the Solid Identity Provider to redirect the user back after they log in. This is the port number to which this local server will be bound."
)

@@ -77,3 +80,3 @@ .locale("en")

...argv,
clientName: argv.appName,
clientName: argv.applicationName,
};

@@ -83,6 +86,8 @@ // Complete CLI arguments with user prompt

solidIdentityProvider:
inputOptions.solidIdentityProvider ?? (await promptIdp()),
inputOptions.solidIdentityProvider ??
(await promptSolidIdentityProvider()),
registrationType:
inputOptions.registrationType ?? (await promptRegistration()),
clientName: inputOptions.clientName ?? (await promptClientName()),
inputOptions.registrationType ?? (await promptRegistrationType()),
applicationName:
inputOptions.applicationName ?? (await promptApplicationName()),
};

@@ -103,3 +108,3 @@ const port = argv.port ?? (await promptPort());

const loginOptions: ILoginInputOptions = {
clientName: validatedOptions.clientName,
clientName: validatedOptions.applicationName,
oidcIssuer: validatedOptions.solidIdentityProvider,

@@ -115,6 +120,8 @@ redirectUrl: iriBase,

console.log(
`Please go perform the static registration of your application to [${validatedOptions.solidIdentityProvider}].`
`Please perform static registration of your application at the Solid Identity Provider [${validatedOptions.solidIdentityProvider}].`
);
console.log(`The redirect IRI will be ${iriBase}`);
console.log(
`The redirect IRI will be [${iriBase}] (you will need this information when registering your application).`
);
console.log(
"At the end of the registration process, you should get a client ID and secret."

@@ -128,6 +135,10 @@ );

console.log(
`Logging in ${validatedOptions.solidIdentityProvider} to get a refresh token.`
`Logging into Solid Identity Provider ${validatedOptions.solidIdentityProvider} to get a refresh token.`
);
session.login(loginOptions).catch((e) => {
throw new Error(`Login failed: ${e.toString()}`);
throw new Error(
`Logging into Solid Identity Provider [${
validatedOptions.solidIdentityProvider
}] failed: ${e.toString()}`
);
});

@@ -156,3 +167,3 @@ });

res.send(
"The tokens have been sent to the bootstraping app. You can close this window."
"The tokens have been sent to @inrupt/generate-oidc-token. You can close this window."
);

@@ -159,0 +170,0 @@ server.close();

@@ -22,3 +22,6 @@ /**

import { IDP_POD_COMPAT, IDP_POD_INRUPT } from "./constants";
import {
IDENTITY_PROVIDER_INRUPT_PROD_COMPAT,
IDENTITY_PROVIDER_INRUPT_PROD,
} from "./constants";
import inquirer from "inquirer";

@@ -31,6 +34,7 @@

choices: [
{ name: IDP_POD_INRUPT },
{ name: IDP_POD_COMPAT },
{ name: IDENTITY_PROVIDER_INRUPT_PROD },
{ name: IDENTITY_PROVIDER_INRUPT_PROD_COMPAT },
{
name: "My Solid Identity provider is not on the list.",
name:
"My Solid Identity provider is not on the list - please contact 'developer-support@inrupt.com' if you'd like to discuss adding a new provider.",
value: undefined,

@@ -44,3 +48,3 @@ },

message:
"What is the URL of the Solid Identity Provider you want to register your app to?",
"What is the URL of the Solid Identity Provider you wish to register your application with?",
name: "solidIdentityProvider",

@@ -50,3 +54,3 @@ default: "",

export async function promptIdp(): Promise<string> {
export async function promptSolidIdentityProvider(): Promise<string> {
let { identityProvider: solidIdentityProvider } = await inquirer.prompt([

@@ -80,3 +84,3 @@ PROMPT_IDP_LIST,

export const promptRegistration = async () =>
export const promptRegistrationType = async () =>
(await inquirer.prompt([PROMPT_REGISTRATION_TYPE])).registrationType;

@@ -86,3 +90,3 @@

type: "input",
message: "What is the name of the app you are registering?",
message: "What is the name of the application you are registering?",
name: "clientName",

@@ -92,3 +96,3 @@ default: undefined,

export const promptClientName = async () =>
export const promptApplicationName = async () =>
(await inquirer.prompt([PROMPT_CLIENT_NAME])).clientName;

@@ -98,3 +102,4 @@

type: "number",
message: "On what port should the identity provider return the token?",
message:
"@inrupt/generate-oidc-token will start a local web server, in order for the Solid Identity Provider to redirect the user back after they log in. To what port should this local server be bound?",
name: "port",

@@ -104,3 +109,3 @@ default: 3001,

if (!input || (input as number) < 0 || (input as number) >= 65536) {
return `The port must be a number in the [0;65536[ range, received [${input}].`;
return `The port must be a number between 0 and 65536, we received [${input}].`;
}

@@ -107,0 +112,0 @@ return true;

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