From e58f02f5e8263bf86ae1f07a863098d445e6d0cd Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Mon, 11 Jul 2022 16:47:40 -0700 Subject: feat: warn on config --auth-type=sso/saml/oauth, undeprecate --auth-type --- lib/utils/config/definitions.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/utils') diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index f58a26768..e654c6b99 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -3,6 +3,7 @@ module.exports = definitions const Definition = require('./definition.js') +const log = require('../log-shim') const { version: npmVersion } = require('../../../package.json') const ciDetect = require('@npmcli/ci-detect') const ciName = ciDetect() @@ -239,12 +240,24 @@ define('audit-level', { define('auth-type', { default: 'legacy', type: ['legacy', 'webauthn', 'sso', 'saml', 'oauth'], + // 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\`. Pass \`webauthn\` to use a web-based login. `, - flatten, + flatten (key, obj, flatOptions) { + flatOptions.authType = obj[key] + if (obj[key] === 'sso') { + // no need to deprecate saml/oauth here, as sso-type will be set by these in + // lib/auth/ and is deprecated already + log.warn('config', + '--auth-type=sso is will be removed in a future version.') + } + }, }) define('before', { -- cgit v1.2.3