Skip to content

Commit 38d82ff

Browse files
committed
Remove "super user" route
1 parent 604de7b commit 38d82ff

File tree

2 files changed

+0
-28
lines changed

2 files changed

+0
-28
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ In Stackhero's console, on your Mosquitto's service configuration, enable `API a
7171
- Protocol: `HTTPS`
7272
- Port: `443`
7373
- User route: `/user`
74-
- Super user route: `/superUser`
7574
- ACLs route: `/acls`
7675

7776
Validate the configuration and voila! Your Mosquitto is now using this Node.js API to validate devices authentication and ACLs!

authenticationServer.js

-27
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const users = [
1010
{
1111
login: 'testUser',
1212
password: 'testPassword',
13-
isSuper: false,
1413
acls: [
1514
{
1615
topic: 'users/testUser/#',
@@ -25,7 +24,6 @@ const users = [
2524
{
2625
login: 'testUser2',
2726
password: 'testPassword2',
28-
isSuper: false,
2927
acls: [
3028
{
3129
topic: 'users/testUser2/#',
@@ -66,31 +64,6 @@ app.post(
6664
);
6765

6866

69-
// Define POST route "/superUser"
70-
// This route will be used to check if the user is a super user or not
71-
app.post(
72-
'/superUser',
73-
(req, res) => {
74-
// Log the route call
75-
console.log(new Date(), req.originalUrl, req.body);
76-
77-
// Mosquitto sends us the username
78-
const { username } = req.body;
79-
80-
// We try to find the user and check if he's a super user
81-
const userFound = users.find(user => user.login === username);
82-
83-
// We send a 200 if he is a super user or 401 else
84-
if (userFound && userFound.isSuper) {
85-
return res.status(200).send();
86-
}
87-
else {
88-
return res.status(401).send();
89-
}
90-
}
91-
);
92-
93-
9467
// Define POST route "/acls"
9568
// This route will be used to check the topic ACL
9669
app.post(

0 commit comments

Comments
 (0)