@verdaccio/auth 8.0.0-next-8.11 → 8.0.0-next-8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -24
- package/package.json +16 -12
- package/.babelrc +0 -3
- package/CHANGELOG.md +0 -1755
- package/src/auth.ts +0 -607
- package/src/index.ts +0 -3
- package/src/signature-legacy.ts +0 -66
- package/src/types.ts +0 -46
- package/src/utils.ts +0 -252
- package/test/auth-utils-middleware.spec.ts +0 -260
- package/test/auth-utils.spec.ts +0 -362
- package/test/auth.spec.ts +0 -722
- package/test/helper/plugin.ts +0 -43
- package/test/partials/config/yaml/security/security-basic.yaml +0 -12
- package/test/partials/config/yaml/security/security-empty.yaml +0 -1
- package/test/partials/config/yaml/security/security-jwt-legacy-enabled.yaml +0 -10
- package/test/partials/config/yaml/security/security-jwt.yaml +0 -6
- package/test/partials/config/yaml/security/security-legacy-disabled.yaml +0 -3
- package/test/partials/config/yaml/security/security-legacy.yaml +0 -3
- package/test/partials/config/yaml/security/security-missing.yaml +0 -0
- package/test/partials/config/yaml/security/security-no-legacy.yaml +0 -9
- package/test/partials/plugin/verdaccio-access-ok/access.js +0 -9
- package/test/partials/plugin/verdaccio-access-ok/package.json +0 -5
- package/test/partials/plugin/verdaccio-adduser/adduser.js +0 -25
- package/test/partials/plugin/verdaccio-adduser/package.json +0 -5
- package/test/partials/plugin/verdaccio-adduser-legacy/adduser.js +0 -25
- package/test/partials/plugin/verdaccio-adduser-legacy/package.json +0 -5
- package/test/partials/plugin/verdaccio-change-password/change.js +0 -32
- package/test/partials/plugin/verdaccio-change-password/package.json +0 -5
- package/test/partials/plugin/verdaccio-fail/fail.js +0 -14
- package/test/partials/plugin/verdaccio-fail/package.json +0 -5
- package/test/partials/plugin/verdaccio-fail-invalid-method/fail.js +0 -11
- package/test/partials/plugin/verdaccio-fail-invalid-method/package.json +0 -5
- package/test/partials/plugin/verdaccio-passthroug/package.json +0 -5
- package/test/partials/plugin/verdaccio-passthroug/passthroug.js +0 -9
- package/test/partials/plugin/verdaccio-success/package.json +0 -5
- package/test/partials/plugin/verdaccio-success/success.js +0 -9
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -32
package/test/helper/plugin.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
|
|
3
|
-
import { getDefaultConfig } from '@verdaccio/config';
|
|
4
|
-
|
|
5
|
-
export const authProfileConf = {
|
|
6
|
-
...getDefaultConfig(),
|
|
7
|
-
plugins: path.join(__dirname, '../partials/plugin'),
|
|
8
|
-
auth: {
|
|
9
|
-
success: {},
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const authChangePasswordConf = {
|
|
14
|
-
...getDefaultConfig(),
|
|
15
|
-
plugins: path.join(__dirname, '../partials/plugin'),
|
|
16
|
-
auth: {
|
|
17
|
-
'change-password': {},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const authPluginFailureConf = {
|
|
22
|
-
...getDefaultConfig(),
|
|
23
|
-
plugins: path.join(__dirname, '../partials/plugin'),
|
|
24
|
-
auth: {
|
|
25
|
-
fail: {},
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const authPluginPassThrougConf = {
|
|
30
|
-
...getDefaultConfig(),
|
|
31
|
-
plugins: path.join(__dirname, '../partials/plugin'),
|
|
32
|
-
auth: {
|
|
33
|
-
passthroug: {},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const authFailInvalidMethod = {
|
|
38
|
-
...getDefaultConfig(),
|
|
39
|
-
plugins: path.join(__dirname, '../partials/plugin'),
|
|
40
|
-
auth: {
|
|
41
|
-
'fail-invalid-method': {},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
security:
|
|
2
|
-
api:
|
|
3
|
-
legacy: true # use AES algorithm
|
|
4
|
-
# jwt enables json web token and disable legacy
|
|
5
|
-
# jwt: https://github.com/auth0/node-jsonwebtoken#jwtsignpayload-secretorprivatekey-options-callback
|
|
6
|
-
sign:
|
|
7
|
-
expiresIn: 7d # 7 days by default
|
|
8
|
-
# verify:
|
|
9
|
-
web:
|
|
10
|
-
sign:
|
|
11
|
-
expiresIn: 7d # 7 days by default
|
|
12
|
-
# verify: https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
security:
|
|
File without changes
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module.exports = function () {
|
|
2
|
-
return {
|
|
3
|
-
authenticate(user, pass, callback) {
|
|
4
|
-
// https://verdaccio.org/docs/en/dev-plugins#onsuccess
|
|
5
|
-
// this is a successful login and return a simple group
|
|
6
|
-
callback(null, ['test']);
|
|
7
|
-
},
|
|
8
|
-
adduser(user, password, cb) {
|
|
9
|
-
if (user === 'fail') {
|
|
10
|
-
return cb(Error('bad username'));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (user === 'password') {
|
|
14
|
-
return cb(Error('bad password'));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (user === 'skip') {
|
|
18
|
-
// if wants to the next plugin
|
|
19
|
-
return cb(null, false);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
cb(null, true);
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module.exports = function () {
|
|
2
|
-
return {
|
|
3
|
-
authenticate(user, pass, callback) {
|
|
4
|
-
// https://verdaccio.org/docs/en/dev-plugins#onsuccess
|
|
5
|
-
// this is a successful login and return a simple group
|
|
6
|
-
callback(null, ['test']);
|
|
7
|
-
},
|
|
8
|
-
add_user(user, password, cb) {
|
|
9
|
-
if (user === 'fail') {
|
|
10
|
-
return cb(Error('bad username'));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (user === 'password') {
|
|
14
|
-
return cb(Error('bad password'));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (user === 'skip') {
|
|
18
|
-
// if wants to the next plugin
|
|
19
|
-
return cb(null, false);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
cb(null, true);
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
module.exports = function () {
|
|
2
|
-
return {
|
|
3
|
-
users: [],
|
|
4
|
-
authenticate(user, pass, callback) {
|
|
5
|
-
// https://verdaccio.org/docs/en/dev-plugins#onsuccess
|
|
6
|
-
// this is a successful login and return a simple group
|
|
7
|
-
callback(null, ['test']);
|
|
8
|
-
},
|
|
9
|
-
changePassword(user, password, newPassword, cb) {
|
|
10
|
-
if (password === newPassword) {
|
|
11
|
-
return cb(Error('error password equal'));
|
|
12
|
-
}
|
|
13
|
-
return cb(null, true);
|
|
14
|
-
},
|
|
15
|
-
adduser(user, password, cb) {
|
|
16
|
-
if (user === 'fail') {
|
|
17
|
-
return cb(Error('bad username'));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (user === 'password') {
|
|
21
|
-
return cb(Error('bad password'));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (user === 'skip') {
|
|
25
|
-
// if wants to the next plugin
|
|
26
|
-
return cb(null, false);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
cb(null, true);
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const { errorUtils } = require('@verdaccio/core');
|
|
2
|
-
|
|
3
|
-
module.exports = function () {
|
|
4
|
-
return {
|
|
5
|
-
authenticate(user, pass, callback) {
|
|
6
|
-
/* user and pass are used here to forward errors
|
|
7
|
-
and success types respectively for testing purposes */
|
|
8
|
-
callback(errorUtils.getInternalError(), false);
|
|
9
|
-
},
|
|
10
|
-
adduser(user, password, cb) {
|
|
11
|
-
return cb(null, false);
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const { errorUtils } = require('@verdaccio/core');
|
|
2
|
-
|
|
3
|
-
module.exports = function () {
|
|
4
|
-
return {
|
|
5
|
-
authenticateFake(user, pass, callback) {
|
|
6
|
-
/* user and pass are used here to forward errors
|
|
7
|
-
and success types respectively for testing purposes */
|
|
8
|
-
callback(errorUtils.getInternalError(), false);
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
};
|
package/tsconfig.build.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.reference",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "./src",
|
|
5
|
-
"outDir": "./build",
|
|
6
|
-
"noImplicitAny": true
|
|
7
|
-
},
|
|
8
|
-
"include": ["src/**/*.ts"],
|
|
9
|
-
"references": [
|
|
10
|
-
{
|
|
11
|
-
"path": "../config"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"path": "../plugins/htpasswd"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"path": "../core/core"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"path": "../loaders"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"path": "../signature"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"path": "../logger/logger"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../utils"
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|