Skip to content

feat: Add --auth-type=webauthn flag #4931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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