Skip to content

Commit

Permalink
feat: Add --auth-type=webauthn flag (#4931)
Browse files Browse the repository at this point in the history
* feat: Add --use-webauth flag

* Add docs

* Switch from a separate flag to a variation of auth-type

* Update snapshot
  • Loading branch information
jumoel authored Jun 1, 2022
1 parent aee6fc8 commit a8ae177
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 11 deletions.
14 changes: 14 additions & 0 deletions docs/content/commands/npm-adduser.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ npm init --scope=@foo --yes
```


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

#### `auth-type`

* Default: "legacy"
* Type: "legacy", "webauthn", "sso", "saml", or "oauth"
* DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in
a future version of npm in favor of web-based login.

What authentication strategy to use with `adduser`/`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: 5 additions & 3 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1891,12 +1891,14 @@ When set to `dev` or `development`, this is an alias for `--include=dev`.
#### `auth-type`

* Default: "legacy"
* Type: "legacy", "sso", "saml", or "oauth"
* DEPRECATED: This method of SSO/SAML/OAuth is deprecated and will be removed
in a future version of npm in favor of web-based login.
* Type: "legacy", "webauthn", "sso", "saml", or "oauth"
* DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in
a future version of npm in favor of web-based login.

What authentication strategy to use with `adduser`/`login`.

Pass `webauthn` to use a web-based login.

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

Expand Down
2 changes: 2 additions & 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'),
webauthn: require('../auth/legacy.js'),
oauth: require('../auth/oauth.js'),
saml: require('../auth/saml.js'),
sso: require('../auth/sso.js'),
Expand All @@ -14,6 +15,7 @@ class AddUser extends BaseCommand {
static params = [
'registry',
'scope',
'auth-type',
]

static ignoreImplicitWorkspace = true
Expand Down
6 changes: 4 additions & 2 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,15 @@ define('audit-level', {

define('auth-type', {
default: 'legacy',
type: ['legacy', 'sso', 'saml', 'oauth'],
type: ['legacy', 'webauthn', 'sso', 'saml', 'oauth'],
deprecated: `
This method of SSO/SAML/OAuth is deprecated and will be removed in
The SSO/SAML/OAuth methods are deprecated and will be removed in
a future version of npm in favor of web-based login.
`,
description: `
What authentication strategy to use with \`adduser\`/\`login\`.
Pass \`webauthn\` to use a web-based login.
`,
flatten,
})
Expand Down
2 changes: 2 additions & 0 deletions tap-snapshots/test/lib/load-all-commands.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ npm adduser
Options:
[--registry <registry>] [--scope <@scope>]
[--auth-type <legacy|webauthn|sso|saml|oauth>]
aliases: login, add-user
Expand Down Expand Up @@ -523,6 +524,7 @@ npm adduser
Options:
[--registry <registry>] [--scope <@scope>]
[--auth-type <legacy|webauthn|sso|saml|oauth>]
aliases: login, add-user
Expand Down
2 changes: 2 additions & 0 deletions tap-snapshots/test/lib/npm.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ All commands:
Options:
[--registry <registry>] [--scope <@scope>]
[--auth-type <legacy|webauthn|sso|saml|oauth>]
aliases: login, add-user
Expand Down Expand Up @@ -601,6 +602,7 @@ All commands:
Options:
[--registry <registry>] [--scope <@scope>]
[--auth-type <legacy|webauthn|sso|saml|oauth>]
aliases: login, add-user
Expand Down
8 changes: 5 additions & 3 deletions tap-snapshots/test/lib/utils/config/definitions.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,13 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for auth-
#### \`auth-type\`
* Default: "legacy"
* Type: "legacy", "sso", "saml", or "oauth"
* DEPRECATED: This method of SSO/SAML/OAuth is deprecated and will be removed
in a future version of npm in favor of web-based login.
* Type: "legacy", "webauthn", "sso", "saml", or "oauth"
* DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in
a future version of npm in favor of web-based login.
What authentication strategy to use with \`adduser\`/\`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: 5 additions & 3 deletions tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1764,12 +1764,14 @@ When set to \`dev\` or \`development\`, this is an alias for \`--include=dev\`.
#### \`auth-type\`
* Default: "legacy"
* Type: "legacy", "sso", "saml", or "oauth"
* DEPRECATED: This method of SSO/SAML/OAuth is deprecated and will be removed
in a future version of npm in favor of web-based login.
* Type: "legacy", "webauthn", "sso", "saml", or "oauth"
* DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in
a future version of npm in favor of web-based login.
What authentication strategy to use with \`adduser\`/\`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 a8ae177

Please sign in to comment.