@node-red/editor-api 2.1.1 → 2.1.5
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/auth/index.js +1 -1
- package/lib/auth/strategies.js +5 -2
- package/lib/editor/locales.js +4 -3
- package/lib/editor/theme.js +5 -0
- package/lib/index.js +2 -0
- package/package.json +7 -7
package/lib/auth/index.js
CHANGED
|
@@ -141,7 +141,7 @@ function completeVerify(profile,done) {
|
|
|
141
141
|
Users.authenticate(profile).then(function(user) {
|
|
142
142
|
if (user) {
|
|
143
143
|
Tokens.create(user.username,"node-red-editor",user.permissions).then(function(tokens) {
|
|
144
|
-
log.audit({event: "auth.login",username:user.username,scope:user.permissions});
|
|
144
|
+
log.audit({event: "auth.login",user,username:user.username,scope:user.permissions});
|
|
145
145
|
user.tokens = tokens;
|
|
146
146
|
done(null,user);
|
|
147
147
|
});
|
package/lib/auth/strategies.js
CHANGED
|
@@ -93,7 +93,7 @@ var passwordTokenExchange = function(client, username, password, scope, done) {
|
|
|
93
93
|
return logEntry.user !== username;
|
|
94
94
|
});
|
|
95
95
|
Tokens.create(username,client.id,scope).then(function(tokens) {
|
|
96
|
-
log.audit({event: "auth.login",username:username,client:client.id,scope:scope});
|
|
96
|
+
log.audit({event: "auth.login",user,username:username,client:client.id,scope:scope});
|
|
97
97
|
done(null,tokens.accessToken,null,{expires_in:tokens.expires_in});
|
|
98
98
|
});
|
|
99
99
|
} else {
|
|
@@ -146,7 +146,7 @@ function authenticateUserToken(req) {
|
|
|
146
146
|
} else {
|
|
147
147
|
reject();
|
|
148
148
|
}
|
|
149
|
-
});
|
|
149
|
+
}).catch(reject);
|
|
150
150
|
} else {
|
|
151
151
|
reject();
|
|
152
152
|
}
|
|
@@ -163,6 +163,9 @@ TokensStrategy.prototype.authenticate = function(req) {
|
|
|
163
163
|
authenticateUserToken(req).then(user => {
|
|
164
164
|
this.success(user,{scope:user.permissions});
|
|
165
165
|
}).catch(err => {
|
|
166
|
+
if (err) {
|
|
167
|
+
log.trace("token authentication failure: "+err.stack?err.stack:err)
|
|
168
|
+
}
|
|
166
169
|
this.fail(401);
|
|
167
170
|
});
|
|
168
171
|
}
|
package/lib/editor/locales.js
CHANGED
|
@@ -48,9 +48,10 @@ module.exports = {
|
|
|
48
48
|
var prevLang = i18n.i.language;
|
|
49
49
|
// Trigger a load from disk of the language if it is not the default
|
|
50
50
|
i18n.i.changeLanguage(lang, function(){
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
i18n.i.changeLanguage(prevLang, function() {
|
|
52
|
+
var catalog = loadResource(lang, namespace);
|
|
53
|
+
res.json(catalog||{});
|
|
54
|
+
});
|
|
53
55
|
});
|
|
54
|
-
i18n.i.changeLanguage(prevLang);
|
|
55
56
|
}
|
|
56
57
|
}
|
package/lib/editor/theme.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -90,6 +90,8 @@ function init(settings,_server,storage,runtimeAPI) {
|
|
|
90
90
|
auth.getToken,
|
|
91
91
|
auth.errorHandler
|
|
92
92
|
);
|
|
93
|
+
} else if (settings.adminAuth.tokens) {
|
|
94
|
+
adminApp.use(passport.initialize());
|
|
93
95
|
}
|
|
94
96
|
adminApp.post("/auth/revoke",auth.needsPermission(""),auth.revoke,apiUtil.errorHandler);
|
|
95
97
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-red/editor-api",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -16,22 +16,22 @@
|
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@node-red/util": "2.1.
|
|
20
|
-
"@node-red/editor-client": "2.1.
|
|
19
|
+
"@node-red/util": "2.1.5",
|
|
20
|
+
"@node-red/editor-client": "2.1.5",
|
|
21
21
|
"bcryptjs": "2.4.3",
|
|
22
|
-
"body-parser": "1.19.
|
|
22
|
+
"body-parser": "1.19.1",
|
|
23
23
|
"clone": "2.1.2",
|
|
24
24
|
"cors": "2.8.5",
|
|
25
25
|
"express-session": "1.17.2",
|
|
26
|
-
"express": "4.17.
|
|
26
|
+
"express": "4.17.2",
|
|
27
27
|
"memorystore": "1.6.6",
|
|
28
28
|
"mime": "2.5.2",
|
|
29
29
|
"multer": "1.4.3",
|
|
30
30
|
"mustache": "4.2.0",
|
|
31
|
-
"oauth2orize": "1.11.
|
|
31
|
+
"oauth2orize": "1.11.1",
|
|
32
32
|
"passport-http-bearer": "1.0.1",
|
|
33
33
|
"passport-oauth2-client-password": "0.1.2",
|
|
34
|
-
"passport": "0.5.
|
|
34
|
+
"passport": "0.5.2",
|
|
35
35
|
"ws": "7.5.1"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|