Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion src/cli/admin/admin-add-autoid-static-user-mapping.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { frodo } from '@rockcarver/frodo-lib';

import { addAutoIdStaticUserMapping } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud'];
const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants;

const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY];

export default function setup() {
const program = new FrodoCommand(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';
import Table from 'cli-table3';
import { Option } from 'commander';
import { v4 as uuidv4 } from 'uuid';
Expand All @@ -11,7 +11,13 @@ import { getTokens } from '../../ops/AuthenticateOps';
import { printError, printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud', 'forgeops'];
const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } =
frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
];

export default function setup() {
const program = new FrodoCommand(
Expand Down
15 changes: 14 additions & 1 deletion src/cli/admin/admin-execute-rfc7523-authz-grant-flow.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { frodo } from '@rockcarver/frodo-lib';
import { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';
import { Option } from 'commander';
import fs from 'fs';
Expand All @@ -9,6 +10,18 @@ import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand.js';

const {
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
CLASSIC_DEPLOYMENT_TYPE_KEY,
} = frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
CLASSIC_DEPLOYMENT_TYPE_KEY,
];

export default function setup() {
const program = new FrodoCommand(
'frodo admin execute-rfc7523-authz-grant-flow'
Expand Down Expand Up @@ -65,7 +78,7 @@ export default function setup() {
options,
command
);
if (await getTokens()) {
if (await getTokens(false, true, deploymentTypes)) {
printMessage(`Executing RFC7523 authorization grant flow...`);
let clientId = uuidv4();
if (options.clientId) {
Expand Down
4 changes: 3 additions & 1 deletion src/cli/admin/admin-federation-export.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { frodo } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { getTokens } from '../../ops/AuthenticateOps';
Expand All @@ -9,7 +10,8 @@ import {
import { printMessage, verboseMessage } from '../../utils/Console';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud'];
const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants;
const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY];

export default function setup() {
const program = new FrodoCommand(
Expand Down
4 changes: 3 additions & 1 deletion src/cli/admin/admin-federation-import.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { frodo } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { getTokens } from '../../ops/AuthenticateOps';
Expand All @@ -10,7 +11,8 @@ import {
import { printMessage, verboseMessage } from '../../utils/Console';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud'];
const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants;
const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY];

export default function setup() {
const program = new FrodoCommand(
Expand Down
5 changes: 4 additions & 1 deletion src/cli/admin/admin-federation-list.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { frodo } from '@rockcarver/frodo-lib';

import { getTokens } from '../../ops/AuthenticateOps';
import { listAdminFederationProviders } from '../../ops/cloud/AdminFederationOps';
import { verboseMessage } from '../../utils/Console';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud'];
const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants;
const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY];

export default function setup() {
const program = new FrodoCommand(
Expand Down
15 changes: 13 additions & 2 deletions src/cli/admin/admin-generate-rfc7523-authz-grant-artefacts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';
import { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';
import { Option } from 'commander';
import fs from 'fs';
Expand All @@ -10,6 +10,17 @@ import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand.js';

const {
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
CLASSIC_DEPLOYMENT_TYPE_KEY,
} = frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
CLASSIC_DEPLOYMENT_TYPE_KEY,
];
export default function setup() {
const program = new FrodoCommand(
'frodo admin generate-rfc7523-authz-grant-artefacts'
Expand Down Expand Up @@ -80,7 +91,7 @@ export default function setup() {
options,
command
);
if (await getTokens()) {
if (await getTokens(false, true, deploymentTypes)) {
printMessage(
`Generating RFC7523 authorization grant artefacts in realm "${state.getRealm()}"...`
);
Expand Down
13 changes: 12 additions & 1 deletion src/cli/admin/admin-get-access-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const {
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
CLASSIC_DEPLOYMENT_TYPE_KEY,
} = frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
CLASSIC_DEPLOYMENT_TYPE_KEY,
];
const { clientCredentialsGrant } = frodo.oauth2oidc.endpoint;
export default function setup() {
const program = new FrodoCommand('frodo admin get-access-token');
Expand Down Expand Up @@ -37,7 +48,7 @@ export default function setup() {
options,
command
);
if (await getTokens()) {
if (await getTokens(false, true, deploymentTypes)) {
printMessage(
`Getting an access token using client "${options.clientId}"...`
);
Expand Down
10 changes: 8 additions & 2 deletions src/cli/admin/admin-grant-oauth2-client-admin-privileges.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { grantOAuth2ClientAdminPrivileges } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud', 'forgeops'];
const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } =
frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
];

export default function setup() {
const program = new FrodoCommand(
Expand Down
5 changes: 3 additions & 2 deletions src/cli/admin/admin-hide-generic-extension-attributes.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { hideGenericExtensionAttributes } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud'];
const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants;
const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY];

export default function setup() {
const program = new FrodoCommand(
Expand Down
10 changes: 8 additions & 2 deletions src/cli/admin/admin-list-oauth2-clients-with-admin-privileges.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';

import { listOAuth2AdminClients } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud', 'forgeops'];
const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } =
frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
];

export default function setup() {
const program = new FrodoCommand(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';

import { listOAuth2CustomClients } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud', 'forgeops'];
const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } =
frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
];

export default function setup() {
const program = new FrodoCommand(
Expand Down
9 changes: 8 additions & 1 deletion src/cli/admin/admin-list-static-user-mappings.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { frodo } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { listNonOAuth2AdminStaticUserMappings } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud', 'forgeops'];
const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } =
frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
];

export default function setup() {
const program = new FrodoCommand(
Expand Down
9 changes: 8 additions & 1 deletion src/cli/admin/admin-remove-static-user-mapping.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { frodo } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { removeStaticUserMapping } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud', 'forgeops'];
const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } =
frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
];

export default function setup() {
const program = new FrodoCommand(
Expand Down
10 changes: 8 additions & 2 deletions src/cli/admin/admin-repair-org-model.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { repairOrgModel } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud', 'forgeops'];
const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } =
frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
];

export default function setup() {
const program = new FrodoCommand(
Expand Down
10 changes: 8 additions & 2 deletions src/cli/admin/admin-revoke-oauth2-client-admin-privileges.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { revokeOAuth2ClientAdminPrivileges } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud', 'forgeops'];
const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } =
frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
];

export default function setup() {
const program = new FrodoCommand(
Expand Down
5 changes: 3 additions & 2 deletions src/cli/admin/admin-show-generic-extension-attributes.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { showGenericExtensionAttributes } from '../../ops/AdminOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { printMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const deploymentTypes = ['cloud'];
const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants;
const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY];

export default function setup() {
const program = new FrodoCommand(
Expand Down
3 changes: 2 additions & 1 deletion src/cli/admin/admin-train-auto-access-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { FrodoCommand } from '../FrodoCommand.js';

const { trainAA } = frodo.admin;

const deploymentTypes = ['cloud'];
const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants;
const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY];

export default function setup() {
const program = new FrodoCommand(
Expand Down
17 changes: 14 additions & 3 deletions src/cli/agent/agent-delete.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import { state } from '@rockcarver/frodo-lib';
import { frodo, state } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import { deleteAgent, deleteAgents } from '../../ops/AgentOps';
import { getTokens } from '../../ops/AuthenticateOps';
import { verboseMessage } from '../../utils/Console.js';
import { FrodoCommand } from '../FrodoCommand';

const {
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
CLASSIC_DEPLOYMENT_TYPE_KEY,
} = frodo.utils.constants;

const deploymentTypes = [
CLOUD_DEPLOYMENT_TYPE_KEY,
FORGEOPS_DEPLOYMENT_TYPE_KEY,
CLASSIC_DEPLOYMENT_TYPE_KEY,
];
export default function setup() {
const program = new FrodoCommand('frodo agent delete');
const program = new FrodoCommand('frodo agent delete', [], deploymentTypes);

program
.description('Delete agents.')
Expand All @@ -29,7 +40,7 @@ export default function setup() {
options,
command
);
if (await getTokens()) {
if (await getTokens(false, true, deploymentTypes)) {
// delete by id
if (options.agentId) {
verboseMessage(
Expand Down
Loading