Skip to content
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

feat: Add web auth type #5076

Merged
merged 1 commit into from
Jul 12, 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
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\`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
What authentication strategy to use with \`login\`.
Pass \`web\` to use a web-based login.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think removing the actual description is what we want here.

`,
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
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