From 46420ea0b2d9bc6ef8fe3a6e8fdf595d0d25e430 Mon Sep 17 00:00:00 2001 From: Maurizio Vitale Date: Thu, 28 Jul 2022 14:02:43 +0200 Subject: [PATCH] [AAE-9169] adf-cli - Change the doc and add clientId input (#7730) * Change the doc and add input * fix mistake --- lib/cli/README.md | 4 ++-- lib/cli/scripts/check-plugin-env.ts | 3 ++- lib/cli/scripts/init-acs-env.ts | 3 ++- lib/cli/scripts/init-aps-env.ts | 3 ++- lib/cli/scripts/plugins/check-env.ts | 5 +++-- lib/cli/scripts/scan-env.ts | 3 ++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/cli/README.md b/lib/cli/README.md index 442a43668c..ba45bfde74 100644 --- a/lib/cli/README.md +++ b/lib/cli/README.md @@ -256,7 +256,7 @@ TEST_APP: { The following command is in charge of checking plugin status by given plugin name: ```bash -adf-cli check-plugin-env --host "gateway_env" --pluginName "Name of the plugin" --appName "appName" -u "username" -p "password" +adf-cli check-plugin-env --host "gateway_env" --pluginName "Name of the plugin" --clientId "clientId" --appName "appName" -u "username" -p "password" --ui "uiName" ``` @@ -265,5 +265,5 @@ adf-cli check-plugin-env --host "gateway_env" --pluginName "Name of the plugin" The following command will scan the environment to show various information on its current status: ```bash -adf-cli scan-env --host "https://example.com" -u "admin" -p "password" +adf-cli scan-env --host "https://example.com" --clientId "clientId" -u "admin" -p "password" ``` diff --git a/lib/cli/scripts/check-plugin-env.ts b/lib/cli/scripts/check-plugin-env.ts index c32bc52a66..c91e3ac1c9 100644 --- a/lib/cli/scripts/check-plugin-env.ts +++ b/lib/cli/scripts/check-plugin-env.ts @@ -12,13 +12,14 @@ export default async function main(_args: string[]) { .version('0.1.0') .option('--host [type]', 'Remote environment host') .option('--pluginName [type]', 'pluginName') + .option('--clientId [type]', 'sso client', 'alfresco') .option('--appName [type]', 'appName ', 'Deployed appName on activiti-cloud') .option('-p, --password [type]', 'password ') .option('-u, --username [type]', 'username ') .option('--ui, --uiName [type]', 'uiName', 'Deployed app UI type on activiti-cloud') .parse(process.argv); - pluginEnv = new CheckEnv(program.host, program.username, program.password); + pluginEnv = new CheckEnv(program.host, program.username, program.password, program.clientId); await pluginEnv.checkEnv(); if (program.pluginName === PluginTarget.processService) { diff --git a/lib/cli/scripts/init-acs-env.ts b/lib/cli/scripts/init-acs-env.ts index dac9435263..c367c1e46e 100755 --- a/lib/cli/scripts/init-acs-env.ts +++ b/lib/cli/scripts/init-acs-env.ts @@ -21,6 +21,7 @@ async function main() { program .version('0.1.0') .option('--host [type]', 'Remote environment host') + .option('--clientId [type]', 'sso client', 'alfresco') .option('-p, --password [type]', 'password ') .option('-u, --username [type]', 'username ') .parse(process.argv); @@ -155,7 +156,7 @@ async function checkEnv() { authType: 'OAUTH', oauth2: { host: `${program.host}/auth/realms/alfresco`, - clientId: 'alfresco', + clientId: `${program.clientId}`, scope: 'openid' } }); diff --git a/lib/cli/scripts/init-aps-env.ts b/lib/cli/scripts/init-aps-env.ts index 9820bed030..65e90b949f 100755 --- a/lib/cli/scripts/init-aps-env.ts +++ b/lib/cli/scripts/init-aps-env.ts @@ -26,6 +26,7 @@ async function main() { program .version('0.1.0') .option('--host [type]', 'Remote environment host') + .option('--clientId [type]', 'sso client', 'alfresco') .option('-p, --password [type]', 'password ') .option('-u, --username [type]', 'username ') .option('--license [type]', 'APS license S3 path ') @@ -119,7 +120,7 @@ async function checkEnv() { authType: 'OAUTH', oauth2: { host: `${program.host}/auth/realms/alfresco`, - clientId: 'alfresco', + clientId: `${program.clientId}`, scope: 'openid' } }); diff --git a/lib/cli/scripts/plugins/check-env.ts b/lib/cli/scripts/plugins/check-env.ts index 6ccdc2fb0c..4709d2725d 100644 --- a/lib/cli/scripts/plugins/check-env.ts +++ b/lib/cli/scripts/plugins/check-env.ts @@ -10,7 +10,8 @@ export class CheckEnv { constructor( private host: string, private username: string, - private password: string + private password: string, + private clientId: string = 'alfresco' ) {} async checkEnv() { @@ -22,7 +23,7 @@ export class CheckEnv { authType: 'OAUTH', oauth2: { host: `${this.host}/auth/realms/alfresco`, - clientId: 'alfresco', + clientId: `${this.clientId}`, scope: 'openid' } } as any); diff --git a/lib/cli/scripts/scan-env.ts b/lib/cli/scripts/scan-env.ts index 911e352c11..88afa927f3 100644 --- a/lib/cli/scripts/scan-env.ts +++ b/lib/cli/scripts/scan-env.ts @@ -29,6 +29,7 @@ export default async function main(_args: string[]) { program .version('0.1.0') .option('--host ', 'Remote environment host') + .option('--clientId [type]', 'sso client', 'alfresco') .option('-p, --password ', 'password ') .option('-u, --username ', 'username ') .parse(process.argv); @@ -79,7 +80,7 @@ async function attemptLogin() { authType: 'OAUTH', oauth2: { host: `${program.host}/auth/realms/alfresco`, - clientId: 'alfresco', + clientId: `${program.clientId}`, scope: 'openid', redirectUri: '/', implicitFlow: false