From e8102c1aae65a18e41253fbcdffe2eff0bedae53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20M=C3=B8ller=20Ellehauge?= Date: Tue, 12 Jul 2022 21:55:00 +0200 Subject: [PATCH] feat: Add `web` auth type (#5076) --- docs/content/commands/npm-adduser.md | 8 +++----- docs/content/using-npm/config.md | 8 +++----- lib/commands/adduser.js | 1 + lib/utils/config/definitions.js | 9 ++++----- tap-snapshots/test/lib/load-all-commands.js.test.cjs | 4 ++-- tap-snapshots/test/lib/npm.js.test.cjs | 4 ++-- .../test/lib/utils/config/definitions.js.test.cjs | 8 +++----- .../test/lib/utils/config/describe-all.js.test.cjs | 8 +++----- 8 files changed, 21 insertions(+), 29 deletions(-) diff --git a/docs/content/commands/npm-adduser.md b/docs/content/commands/npm-adduser.md index aaa62e1b92760..700aecb2255b2 100644 --- a/docs/content/commands/npm-adduser.md +++ b/docs/content/commands/npm-adduser.md @@ -93,15 +93,13 @@ npm init --scope=@foo --yes #### `auth-type` * Default: "legacy" -* Type: "legacy", "webauthn", "sso", "saml", or "oauth" +* Type: "legacy", "web", "sso", "saml", "oauth", or "webauthn" -NOTE: auth-type values "sso", "saml", and "oauth" will be removed in a -future version. +NOTE: auth-type values "sso", "saml", "oauth", and "webauthn" will be +removed in a future version. What authentication strategy to use with `login`. -Pass `webauthn` to use a web-based login. - diff --git a/docs/content/using-npm/config.md b/docs/content/using-npm/config.md index debb256369002..ffbf9be055719 100644 --- a/docs/content/using-npm/config.md +++ b/docs/content/using-npm/config.md @@ -218,15 +218,13 @@ exit code. #### `auth-type` * Default: "legacy" -* Type: "legacy", "webauthn", "sso", "saml", or "oauth" +* Type: "legacy", "web", "sso", "saml", "oauth", or "webauthn" -NOTE: auth-type values "sso", "saml", and "oauth" will be removed in a -future version. +NOTE: auth-type values "sso", "saml", "oauth", and "webauthn" will be +removed in a future version. What authentication strategy to use with `login`. -Pass `webauthn` to use a web-based login. - diff --git a/lib/commands/adduser.js b/lib/commands/adduser.js index 29eb5acf870d6..5e23f40dc5968 100644 --- a/lib/commands/adduser.js +++ b/lib/commands/adduser.js @@ -3,6 +3,7 @@ const replaceInfo = require('../utils/replace-info.js') const BaseCommand = require('../base-command.js') const authTypes = { legacy: require('../auth/legacy.js'), + web: require('../auth/legacy.js'), webauthn: require('../auth/legacy.js'), oauth: require('../auth/oauth.js'), saml: require('../auth/saml.js'), diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index e654c6b994d74..665ed1efe5e61 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -239,15 +239,14 @@ define('audit-level', { define('auth-type', { default: 'legacy', - type: ['legacy', 'webauthn', 'sso', 'saml', 'oauth'], + type: ['legacy', 'web', 'sso', 'saml', 'oauth', 'webauthn'], // deprecation in description rather than field, because not every value // is deprecated description: ` - NOTE: auth-type values "sso", "saml", and "oauth" will be removed in a future version. - - What authentication strategy to use with \`login\`. + NOTE: auth-type values "sso", "saml", "oauth", and "webauthn" will be + removed in a future version. - Pass \`webauthn\` to use a web-based login. + What authentication strategy to use with \`login\`. `, flatten (key, obj, flatOptions) { flatOptions.authType = obj[key] diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index ef832be1ba65a..b697dfbb796c6 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -33,7 +33,7 @@ npm adduser Options: [--registry ] [--scope <@scope>] -[--auth-type ] +[--auth-type ] aliases: login, add-user @@ -499,7 +499,7 @@ npm adduser Options: [--registry ] [--scope <@scope>] -[--auth-type ] +[--auth-type ] aliases: login, add-user diff --git a/tap-snapshots/test/lib/npm.js.test.cjs b/tap-snapshots/test/lib/npm.js.test.cjs index c87e947fc1a03..3cdf37684de27 100644 --- a/tap-snapshots/test/lib/npm.js.test.cjs +++ b/tap-snapshots/test/lib/npm.js.test.cjs @@ -190,7 +190,7 @@ All commands: Options: [--registry ] [--scope <@scope>] - [--auth-type ] + [--auth-type ] aliases: login, add-user @@ -577,7 +577,7 @@ All commands: Options: [--registry ] [--scope <@scope>] - [--auth-type ] + [--auth-type ] aliases: login, add-user diff --git a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index 5a06f2c4b24ef..04d304a2254d9 100644 --- a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -253,14 +253,12 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for auth- #### \`auth-type\` * Default: "legacy" -* Type: "legacy", "webauthn", "sso", "saml", or "oauth" +* Type: "legacy", "web", "sso", "saml", "oauth", or "webauthn" -NOTE: auth-type values "sso", "saml", and "oauth" will be removed in a -future version. +NOTE: auth-type values "sso", "saml", "oauth", and "webauthn" will be +removed in a future version. What authentication strategy to use with \`login\`. - -Pass \`webauthn\` to use a web-based login. ` exports[`test/lib/utils/config/definitions.js TAP > config description for before 1`] = ` diff --git a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs index a06f53012d072..a291af6dedfae 100644 --- a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs @@ -91,15 +91,13 @@ exit code. #### \`auth-type\` * Default: "legacy" -* Type: "legacy", "webauthn", "sso", "saml", or "oauth" +* Type: "legacy", "web", "sso", "saml", "oauth", or "webauthn" -NOTE: auth-type values "sso", "saml", and "oauth" will be removed in a -future version. +NOTE: auth-type values "sso", "saml", "oauth", and "webauthn" will be +removed in a future version. What authentication strategy to use with \`login\`. -Pass \`webauthn\` to use a web-based login. -