verdaccio-auth-memory 10.2.0 → 10.2.1
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/lib/Memory.d.ts +1 -1
- package/lib/Memory.js +3 -46
- package/lib/Memory.js.map +1 -1
- package/lib/index.js +0 -3
- package/lib/index.js.map +1 -1
- package/package.json +3 -4
package/lib/Memory.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config, PluginOptions, Callback, PackageAccess, IPluginAuth, RemoteUser, Logger } from '@verdaccio/types';
|
|
1
|
+
import { Config, PluginOptions, Callback, PackageAccess, IPluginAuth, RemoteUser, Logger } from '@verdaccio/legacy-types';
|
|
2
2
|
export interface UserMemory {
|
|
3
3
|
name: string;
|
|
4
4
|
password: string;
|
package/lib/Memory.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _commonsApi = require("@verdaccio/commons-api");
|
|
9
|
-
|
|
10
8
|
class Memory {
|
|
11
9
|
constructor(config, appOptions) {
|
|
12
10
|
this._users = config.users || {};
|
|
@@ -14,161 +12,120 @@ class Memory {
|
|
|
14
12
|
this._logger = appOptions.logger;
|
|
15
13
|
this._app_config = appOptions.config;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
authenticate(user, password, done) {
|
|
19
16
|
const userCredentials = this._users[user];
|
|
20
|
-
|
|
21
17
|
if (!userCredentials) {
|
|
22
18
|
this._logger.debug({
|
|
23
19
|
user
|
|
24
20
|
}, '[VerdaccioMemory] user @{user} does not exist');
|
|
25
|
-
|
|
26
21
|
return done(null, false);
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
if (password !== userCredentials.password) {
|
|
30
24
|
const err = (0, _commonsApi.getUnauthorized)("i don't like your password");
|
|
31
|
-
|
|
32
25
|
this._logger.info({
|
|
33
26
|
user
|
|
34
27
|
}, '[VerdaccioMemory] password invalid for: @{user}');
|
|
35
|
-
|
|
36
28
|
return done(err);
|
|
37
|
-
}
|
|
38
|
-
// return all usergroups this user has access to;
|
|
39
|
-
|
|
29
|
+
}
|
|
40
30
|
|
|
31
|
+
// authentication succeeded!
|
|
32
|
+
// return all usergroups this user has access to;
|
|
41
33
|
this._logger.info({
|
|
42
34
|
user
|
|
43
35
|
}, '[VerdaccioMemory] authentication succeeded for @{user}');
|
|
44
|
-
|
|
45
36
|
return done(null, [user]);
|
|
46
37
|
}
|
|
47
|
-
|
|
48
38
|
adduser(user, password, done) {
|
|
49
39
|
if (this._users[user]) {
|
|
50
40
|
this._logger.debug({
|
|
51
41
|
user
|
|
52
42
|
}, '[VerdaccioMemory] user @{user} already exist');
|
|
53
|
-
|
|
54
43
|
return done(null, true);
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
if (this._app_config.max_users) {
|
|
58
46
|
if (Object.keys(this._users).length >= this._app_config.max_users) {
|
|
59
47
|
const err = (0, _commonsApi.getConflict)('maximum amount of users reached');
|
|
60
48
|
return done(err);
|
|
61
49
|
}
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
this._users[user] = {
|
|
65
52
|
name: user,
|
|
66
53
|
password: password
|
|
67
54
|
};
|
|
68
|
-
|
|
69
55
|
this._logger.info({
|
|
70
56
|
user
|
|
71
57
|
}, '[VerdaccioMemory] user added succeeded for @{user}');
|
|
72
|
-
|
|
73
58
|
done(null, user);
|
|
74
59
|
}
|
|
75
|
-
|
|
76
60
|
changePassword(username, password, newPassword, cb) {
|
|
77
61
|
const user = this._users[username];
|
|
78
|
-
|
|
79
62
|
this._logger.debug({
|
|
80
63
|
user: username
|
|
81
64
|
}, 'user: @{user} init change password');
|
|
82
|
-
|
|
83
65
|
if (user && user.password === password) {
|
|
84
66
|
user.password = newPassword;
|
|
85
67
|
this._users[username] = user;
|
|
86
|
-
|
|
87
68
|
this._logger.info({
|
|
88
69
|
user
|
|
89
70
|
}, '[VerdaccioMemory] user changed password succeeded for @{user}');
|
|
90
|
-
|
|
91
71
|
cb(null, user);
|
|
92
72
|
} else {
|
|
93
73
|
const err = (0, _commonsApi.getNotFound)('user not found');
|
|
94
|
-
|
|
95
74
|
this._logger.debug({
|
|
96
75
|
user: username
|
|
97
76
|
}, 'change password user @{user} not found');
|
|
98
|
-
|
|
99
77
|
return cb(err);
|
|
100
78
|
}
|
|
101
79
|
}
|
|
102
|
-
|
|
103
80
|
allow_access(user, pkg, cb) {
|
|
104
81
|
if (pkg.access && pkg.access.includes('$all') || pkg.access && pkg.access.includes('$anonymous')) {
|
|
105
82
|
this._logger.debug({
|
|
106
83
|
user: user.name
|
|
107
84
|
}, '[VerdaccioMemory] user: @{user} has been granted access');
|
|
108
|
-
|
|
109
85
|
return cb(null, true);
|
|
110
86
|
}
|
|
111
|
-
|
|
112
87
|
if (!user.name) {
|
|
113
88
|
const err = (0, _commonsApi.getForbidden)('not allowed to access package');
|
|
114
|
-
|
|
115
89
|
this._logger.debug({
|
|
116
90
|
user: user.name
|
|
117
91
|
}, 'user: @{user} not allowed to access package');
|
|
118
|
-
|
|
119
92
|
return cb(err);
|
|
120
93
|
}
|
|
121
|
-
|
|
122
94
|
if (pkg.access && pkg.access.includes(user.name) || pkg.access && pkg.access.includes('$authenticated')) {
|
|
123
95
|
this._logger.debug({
|
|
124
96
|
user: user.name
|
|
125
97
|
}, '[VerdaccioMemory] user: @{user} has been granted access');
|
|
126
|
-
|
|
127
98
|
return cb(null, true);
|
|
128
99
|
}
|
|
129
|
-
|
|
130
100
|
const err = (0, _commonsApi.getForbidden)('not allowed to access package');
|
|
131
|
-
|
|
132
101
|
this._logger.debug({
|
|
133
102
|
user: user.name
|
|
134
103
|
}, '[VerdaccioMemory] user: @{user} not allowed to access package');
|
|
135
|
-
|
|
136
104
|
return cb(err);
|
|
137
105
|
}
|
|
138
|
-
|
|
139
106
|
allow_publish(user, pkg, cb) {
|
|
140
107
|
if (pkg.publish && pkg.publish.includes('$all') || pkg.publish && pkg.publish.includes('$anonymous')) {
|
|
141
108
|
this._logger.debug({
|
|
142
109
|
user: user.name
|
|
143
110
|
}, '[VerdaccioMemory] user: @{user} has been granted to publish');
|
|
144
|
-
|
|
145
111
|
return cb(null, true);
|
|
146
112
|
}
|
|
147
|
-
|
|
148
113
|
if (!user.name) {
|
|
149
114
|
const err = (0, _commonsApi.getForbidden)('not allowed to publish package');
|
|
150
|
-
|
|
151
115
|
this._logger.debug({
|
|
152
116
|
user: user.name
|
|
153
117
|
}, 'user: @{user} not allowed to publish package');
|
|
154
|
-
|
|
155
118
|
return cb(err);
|
|
156
119
|
}
|
|
157
|
-
|
|
158
120
|
if (pkg.publish && pkg.publish.includes(user.name) || pkg.publish && pkg.publish.includes('$authenticated')) {
|
|
159
121
|
return cb(null, true);
|
|
160
122
|
}
|
|
161
|
-
|
|
162
123
|
const err = (0, _commonsApi.getForbidden)('not allowed to publish package');
|
|
163
|
-
|
|
164
124
|
this._logger.debug({
|
|
165
125
|
user: user.name
|
|
166
126
|
}, '[VerdaccioMemory] user: @{user} not allowed to publish package');
|
|
167
|
-
|
|
168
127
|
return cb(err);
|
|
169
128
|
}
|
|
170
|
-
|
|
171
129
|
}
|
|
172
|
-
|
|
173
130
|
exports.default = Memory;
|
|
174
131
|
//# sourceMappingURL=Memory.js.map
|
package/lib/Memory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Memory.js","names":["_commonsApi","require","Memory","constructor","config","appOptions","_users","users","_config","_logger","logger","_app_config","authenticate","user","password","done","userCredentials","debug","err","getUnauthorized","info","adduser","max_users","Object","keys","length","getConflict","name","changePassword","username","newPassword","cb","getNotFound","allow_access","pkg","access","includes","getForbidden","allow_publish","publish","exports","default"],"sources":["../src/Memory.ts"],"sourcesContent":["import { Config, PluginOptions, Callback, PackageAccess, IPluginAuth, RemoteUser, Logger } from '@verdaccio/legacy-types';\nimport { getConflict, getForbidden, getNotFound, getUnauthorized } from '@verdaccio/commons-api';\n\nexport interface UserMemory {\n name: string;\n password: string;\n}\n\nexport interface Users {\n [key: string]: UserMemory;\n}\n\nexport interface VerdaccioMemoryConfig extends Config {\n max_users?: number;\n users: Users;\n}\n\n\nexport default class Memory implements IPluginAuth<VerdaccioMemoryConfig> {\n public _logger: Logger;\n public _users: Users;\n public _config: {};\n public _app_config: VerdaccioMemoryConfig;\n\n public constructor(config: VerdaccioMemoryConfig, appOptions: PluginOptions<VerdaccioMemoryConfig>) {\n this._users = config.users || {};\n this._config = config;\n this._logger = appOptions.logger;\n this._app_config = appOptions.config;\n }\n\n public authenticate(user: string, password: string, done: Callback): void {\n const userCredentials = this._users[user];\n\n if (!userCredentials) {\n this._logger.debug({ user }, '[VerdaccioMemory] user @{user} does not exist');\n return done(null, false);\n }\n\n if (password !== userCredentials.password) {\n const err = getUnauthorized(\"i don't like your password\");\n this._logger.info({ user }, '[VerdaccioMemory] password invalid for: @{user}');\n\n return done(err);\n }\n\n // authentication succeeded!\n // return all usergroups this user has access to;\n this._logger.info({ user }, '[VerdaccioMemory] authentication succeeded for @{user}');\n return done(null, [user]);\n }\n\n public adduser(user: string, password: string, done: Callback): void {\n if (this._users[user]) {\n this._logger.debug({ user }, '[VerdaccioMemory] user @{user} already exist');\n return done(null, true);\n }\n\n if (this._app_config.max_users) {\n if (Object.keys(this._users).length >= this._app_config.max_users) {\n const err = getConflict('maximum amount of users reached');\n\n return done(err);\n }\n }\n\n this._users[user] = { name: user, password: password };\n\n this._logger.info({ user }, '[VerdaccioMemory] user added succeeded for @{user}');\n done(null, user);\n }\n\n public changePassword(username: string, password: string, newPassword: string, cb: Callback): void {\n const user: UserMemory = this._users[username];\n this._logger.debug({ user: username }, 'user: @{user} init change password');\n\n if (user && user.password === password) {\n user.password = newPassword;\n this._users[username] = user;\n\n this._logger.info({ user }, '[VerdaccioMemory] user changed password succeeded for @{user}');\n cb(null, user);\n } else {\n const err = getNotFound('user not found');\n this._logger.debug({ user: username }, 'change password user @{user} not found');\n\n return cb(err);\n }\n }\n\n public allow_access(user: RemoteUser, pkg: PackageAccess, cb: Callback): void {\n if ((pkg.access && pkg.access.includes('$all')) || (pkg.access && pkg.access.includes('$anonymous'))) {\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} has been granted access');\n\n return cb(null, true);\n }\n\n if (!user.name) {\n const err = getForbidden('not allowed to access package');\n this._logger.debug({ user: user.name }, 'user: @{user} not allowed to access package');\n return cb(err);\n }\n\n if ((pkg.access && pkg.access.includes(user.name)) || (pkg.access && pkg.access.includes('$authenticated'))) {\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} has been granted access');\n return cb(null, true);\n }\n\n const err = getForbidden('not allowed to access package');\n\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} not allowed to access package');\n return cb(err);\n }\n\n public allow_publish(user: RemoteUser, pkg: PackageAccess, cb: Callback): void {\n if ((pkg.publish && pkg.publish.includes('$all')) || (pkg.publish && pkg.publish.includes('$anonymous'))) {\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} has been granted to publish');\n return cb(null, true);\n }\n\n if (!user.name) {\n const err = getForbidden('not allowed to publish package');\n this._logger.debug({ user: user.name }, 'user: @{user} not allowed to publish package');\n\n return cb(err);\n }\n\n if ((pkg.publish && pkg.publish.includes(user.name)) || (pkg.publish && pkg.publish.includes('$authenticated'))) {\n return cb(null, true);\n }\n\n const err = getForbidden('not allowed to publish package');\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} not allowed to publish package');\n\n return cb(err);\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAiBe,MAAMC,MAAM,CAA+C;EAMjEC,WAAWA,CAACC,MAA6B,EAAEC,UAAgD,EAAE;IAClG,IAAI,CAACC,MAAM,GAAGF,MAAM,CAACG,KAAK,IAAI,CAAC,CAAC;IAChC,IAAI,CAACC,OAAO,GAA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-
|
|
14
13
|
var _Memory = _interopRequireDefault(require("./Memory"));
|
|
15
|
-
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
15
|
var _default = _Memory.default;
|
|
19
16
|
exports.default = _default;
|
|
20
17
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Memory","_interopRequireDefault","require","obj","__esModule","default","_default","Memory","exports"],"sources":["../src/index.ts"],"sourcesContent":["import Memory from './Memory';\n\nexport { Memory };\n\nexport default Memory;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAIfC,eAAM;AAAAC,OAAA,CAAAH,OAAA,GAAAC,QAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verdaccio-auth-memory",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.1",
|
|
4
4
|
"description": "Auth plugin for Verdaccio that keeps users in memory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"verdaccio",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@verdaccio/commons-api": "10.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@verdaccio/types": "
|
|
34
|
+
"@verdaccio/legacy-types": "1.0.1"
|
|
35
35
|
},
|
|
36
36
|
"funding": {
|
|
37
37
|
"type": "opencollective",
|
|
@@ -45,6 +45,5 @@
|
|
|
45
45
|
"build:js": "babel src/ --out-dir lib/ --copy-files --extensions \".ts,.tsx\" --source-maps",
|
|
46
46
|
"watch": "pnpm build:js -- --watch",
|
|
47
47
|
"build": "pnpm run build:js && pnpm run build:types"
|
|
48
|
-
}
|
|
49
|
-
"readme": "# verdaccio-auth-memory\n[](https://app.fossa.io/projects/git%2Bgithub.com%2Fverdaccio%2Fverdaccio-auth-memory?ref=badge_shield)\n[](https://circleci.com/gh/ayusharma/verdaccio-auth-memory)\n[](https://codecov.io/gh/verdaccio/verdaccio-auth-memory)\n\n\nThis verdaccio auth plugin keeps the users in a memory plain object.\nThis means all sessions and users will disappear when you restart the verdaccio server.\n\nIf you want to use this piece of software, do it at your own risk. **This plugin is being used for unit testing**.\n\n## Installation\n\n```sh\n$ npm install -g verdaccio\n$ npm install -g verdaccio-auth-memory\n```\n\n## Config\n\nAdd to your `config.yaml`:\n\n```yaml\nauth:\n auth-memory:\n users:\n foo:\n name: foo\n password: s3cret\n bar:\n name: bar\n password: s3cret\n```\n\n## For plugin writers\n\nIt's called as:\n\n```js\nconst plugin = require('verdaccio-auth-memory');\n\nplugin(config, appConfig);\n```\n\nWhere:\n\n - config - module's own config\n - appOptions - collection of different internal verdaccio objects\n - appOptions.config - main config\n - appOptions.logger - logger\n\nThis should export four functions:\n\n - `adduser(user, password, cb)` Add new users\n\n It should respond with:\n - `cb(err)` in case of an error (error will be returned to user)\n - `cb(null, false)` in case registration is disabled (next auth plugin will be executed)\n - `cb(null, true)` in case user registered successfully\n\n It's useful to set `err.status` property to set http status code (e.g. `err.status = 403`).\n\n - `authenticate(user, password, cb)` Authenticate the user\n\n It should respond with:\n - `cb(err)` in case of a fatal error (error will be returned to user, keep those rare)\n - `cb(null, false)` in case user not authenticated (next auth plugin will be executed)\n - `cb(null, [groups])` in case user is authenticated\n\n Groups is an array of all users/usergroups this user has access to. You should probably include username itself here.\n\n - `allow_access(user, pkg, cb)` Check whether the user has permissions to access a resource (package)\n\n It should respond with:\n - `cb(err)` in case of a fatal error (error will be returned to user, keep those rare)\n - `cb(null, false)` in case user not allowed to access (next auth plugin will be executed)\n - `cb(null, true)` in case user is allowed to access\n\n - `allow_publish(user, pkg, cb)` Check whether the user has permissions to publish a resource (package)\n\n It should respond with:\n - `cb(err)` in case of a fatal error (error will be returned to user, keep those rare)\n - `cb(null, false)` in case user not allowed to publish (next auth plugin will be executed)\n - `cb(null, true)` in case user is allowed to publish\n\n\n\n## License\n[](https://app.fossa.io/projects/git%2Bgithub.com%2Fverdaccio%2Fverdaccio-auth-memory?ref=badge_large)\n"
|
|
48
|
+
}
|
|
50
49
|
}
|