Skip to content

Commit

Permalink
feat: add web auth type
Browse files Browse the repository at this point in the history
  • Loading branch information
jumoel authored and wraithgar committed Jul 12, 2022
1 parent d3791e6 commit 0e0310b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 29 deletions.
8 changes: 3 additions & 5 deletions docs/content/commands/npm-adduser.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

Expand Down
8 changes: 3 additions & 5 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->

Expand Down
1 change: 1 addition & 0 deletions lib/commands/adduser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
9 changes: 4 additions & 5 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions tap-snapshots/test/lib/load-all-commands.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ npm adduser
Options:
[--registry <registry>] [--scope <@scope>]
[--auth-type <legacy|webauthn|sso|saml|oauth>]
[--auth-type <legacy|web|sso|saml|oauth|webauthn>]
aliases: login, add-user
Expand Down Expand Up @@ -499,7 +499,7 @@ npm adduser
Options:
[--registry <registry>] [--scope <@scope>]
[--auth-type <legacy|webauthn|sso|saml|oauth>]
[--auth-type <legacy|web|sso|saml|oauth|webauthn>]
aliases: login, add-user
Expand Down
4 changes: 2 additions & 2 deletions tap-snapshots/test/lib/npm.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ All commands:
Options:
[--registry <registry>] [--scope <@scope>]
[--auth-type <legacy|webauthn|sso|saml|oauth>]
[--auth-type <legacy|web|sso|saml|oauth|webauthn>]
aliases: login, add-user
Expand Down Expand Up @@ -577,7 +577,7 @@ All commands:
Options:
[--registry <registry>] [--scope <@scope>]
[--auth-type <legacy|webauthn|sso|saml|oauth>]
[--auth-type <legacy|web|sso|saml|oauth|webauthn>]
aliases: login, add-user
Expand Down
8 changes: 3 additions & 5 deletions tap-snapshots/test/lib/utils/config/definitions.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`] = `
Expand Down
8 changes: 3 additions & 5 deletions tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
Expand Down

0 comments on commit 0e0310b

Please sign in to comment.