Skip to content

Commit a8ae177

Browse files
authored
feat: Add --auth-type=webauthn flag (#4931)
* feat: Add --use-webauth flag * Add docs * Switch from a separate flag to a variation of auth-type * Update snapshot
1 parent aee6fc8 commit a8ae177

File tree

8 files changed

+39
-11
lines changed

8 files changed

+39
-11
lines changed

docs/content/commands/npm-adduser.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ npm init --scope=@foo --yes
8787
```
8888

8989

90+
<!-- automatically generated, do not edit manually -->
91+
<!-- see lib/utils/config/definitions.js -->
92+
93+
#### `auth-type`
94+
95+
* Default: "legacy"
96+
* Type: "legacy", "webauthn", "sso", "saml", or "oauth"
97+
* DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in
98+
a future version of npm in favor of web-based login.
99+
100+
What authentication strategy to use with `adduser`/`login`.
101+
102+
Pass `webauthn` to use a web-based login.
103+
90104
<!-- automatically generated, do not edit manually -->
91105
<!-- see lib/utils/config/definitions.js -->
92106

docs/content/using-npm/config.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,12 +1891,14 @@ When set to `dev` or `development`, this is an alias for `--include=dev`.
18911891
#### `auth-type`
18921892

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

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

1900+
Pass `webauthn` to use a web-based login.
1901+
19001902
<!-- automatically generated, do not edit manually -->
19011903
<!-- see lib/utils/config/definitions.js -->
19021904

lib/commands/adduser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const replaceInfo = require('../utils/replace-info.js')
33
const BaseCommand = require('../base-command.js')
44
const authTypes = {
55
legacy: require('../auth/legacy.js'),
6+
webauthn: require('../auth/legacy.js'),
67
oauth: require('../auth/oauth.js'),
78
saml: require('../auth/saml.js'),
89
sso: require('../auth/sso.js'),
@@ -14,6 +15,7 @@ class AddUser extends BaseCommand {
1415
static params = [
1516
'registry',
1617
'scope',
18+
'auth-type',
1719
]
1820

1921
static ignoreImplicitWorkspace = true

lib/utils/config/definitions.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,15 @@ define('audit-level', {
238238

239239
define('auth-type', {
240240
default: 'legacy',
241-
type: ['legacy', 'sso', 'saml', 'oauth'],
241+
type: ['legacy', 'webauthn', 'sso', 'saml', 'oauth'],
242242
deprecated: `
243-
This method of SSO/SAML/OAuth is deprecated and will be removed in
243+
The SSO/SAML/OAuth methods are deprecated and will be removed in
244244
a future version of npm in favor of web-based login.
245245
`,
246246
description: `
247247
What authentication strategy to use with \`adduser\`/\`login\`.
248+
249+
Pass \`webauthn\` to use a web-based login.
248250
`,
249251
flatten,
250252
})

tap-snapshots/test/lib/load-all-commands.js.test.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ npm adduser
3333
3434
Options:
3535
[--registry <registry>] [--scope <@scope>]
36+
[--auth-type <legacy|webauthn|sso|saml|oauth>]
3637
3738
aliases: login, add-user
3839
@@ -523,6 +524,7 @@ npm adduser
523524
524525
Options:
525526
[--registry <registry>] [--scope <@scope>]
527+
[--auth-type <legacy|webauthn|sso|saml|oauth>]
526528
527529
aliases: login, add-user
528530

tap-snapshots/test/lib/npm.js.test.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ All commands:
190190
191191
Options:
192192
[--registry <registry>] [--scope <@scope>]
193+
[--auth-type <legacy|webauthn|sso|saml|oauth>]
193194
194195
aliases: login, add-user
195196
@@ -601,6 +602,7 @@ All commands:
601602
602603
Options:
603604
[--registry <registry>] [--scope <@scope>]
605+
[--auth-type <legacy|webauthn|sso|saml|oauth>]
604606
605607
aliases: login, add-user
606608

tap-snapshots/test/lib/utils/config/definitions.js.test.cjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,13 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for auth-
253253
#### \`auth-type\`
254254
255255
* Default: "legacy"
256-
* Type: "legacy", "sso", "saml", or "oauth"
257-
* DEPRECATED: This method of SSO/SAML/OAuth is deprecated and will be removed
258-
in a future version of npm in favor of web-based login.
256+
* Type: "legacy", "webauthn", "sso", "saml", or "oauth"
257+
* DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in
258+
a future version of npm in favor of web-based login.
259259
260260
What authentication strategy to use with \`adduser\`/\`login\`.
261+
262+
Pass \`webauthn\` to use a web-based login.
261263
`
262264

263265
exports[`test/lib/utils/config/definitions.js TAP > config description for before 1`] = `

tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,12 +1764,14 @@ When set to \`dev\` or \`development\`, this is an alias for \`--include=dev\`.
17641764
#### \`auth-type\`
17651765
17661766
* Default: "legacy"
1767-
* Type: "legacy", "sso", "saml", or "oauth"
1768-
* DEPRECATED: This method of SSO/SAML/OAuth is deprecated and will be removed
1769-
in a future version of npm in favor of web-based login.
1767+
* Type: "legacy", "webauthn", "sso", "saml", or "oauth"
1768+
* DEPRECATED: The SSO/SAML/OAuth methods are deprecated and will be removed in
1769+
a future version of npm in favor of web-based login.
17701770
17711771
What authentication strategy to use with \`adduser\`/\`login\`.
17721772
1773+
Pass \`webauthn\` to use a web-based login.
1774+
17731775
<!-- automatically generated, do not edit manually -->
17741776
<!-- see lib/utils/config/definitions.js -->
17751777

0 commit comments

Comments
 (0)