Skip to content

Commit 85271f6

Browse files
committed
Fixed cording style.
Refined minor code issues. - Removed "CNAME" from auth.json and tests. - Added plain_password for auth.json example. - Removed unused constants. - Renamed cname related variable name to cn - Added `const` to some member functions. - Removed const& from string_view.
1 parent 9da0a15 commit 85271f6

File tree

9 files changed

+623
-352
lines changed

9 files changed

+623
-352
lines changed

example/auth.json

+78-69
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,79 @@
11
{
2-
# Configure username/login
3-
"authentication": [
4-
{
5-
# Authenticates user by password using sha256 hash and specified salt for password sha256(salt + password)
6-
"name": "u1",
7-
"method": "sha256",
8-
"salt": "salt",
9-
"digest": "38ea2e5e88fcd692fe177c6cada15e9b2db6e70bee0a0d6678c8d3b2a9aae2ad"
10-
}
11-
,
12-
{
13-
# Authenticates user by client certificate
14-
"name": "u2",
15-
"method": "client_cert",
16-
"field": "CNAME"
17-
}
18-
,
19-
{
20-
# Handles all users that login without username / password
21-
"name": "anonymous",
22-
"method": "anonymous"
23-
}
24-
,
25-
{
26-
# Handles all users that are not authenticated (non-existing user, invalid password)
27-
"name": "unauthenticated",
28-
"method": "unauthenticated"
29-
}
30-
],
31-
32-
# Combine users into groups
33-
"groups": [
34-
{
35-
# Users can be combined into groups, group name starts with @
36-
"name": "@g1",
37-
"members": ["u1", "u2", "anonymous", "unauthenticated"]
38-
}
39-
],
40-
41-
# Give access to topics
42-
"authorization": [
43-
{
44-
# Specified users and groups are denied to publish on this topic
45-
"topic": "#",
46-
"deny": { "pub": ["@g1"] }
47-
},
48-
{
49-
# Specified users and groups are denied to subscribe on this topic"
50-
"topic": "#",
51-
"deny": { "sub": ["@g1"] }
52-
},
53-
{
54-
# Specified users and groups are allowed to subscribe and publish on this topic"
55-
"topic": "sub/#",
56-
"allow": {
57-
"sub": ["@g1"],
58-
"pub": ["@g1"]
59-
}
60-
},
61-
{
62-
# Specified users and groups are denied to subscribe and publish on this topic
63-
"topic": "sub/topic1",
64-
"deny": {
65-
"sub": ["u1", "anonymous"],
66-
"pub": ["u1", "anonymous"]
67-
}
68-
}
69-
]
70-
}
2+
# Configure username/login
3+
"authentication": [
4+
{
5+
# Authenticates user by password using sha256 hash and specified salt for password sha256(salt + password)
6+
"name": "u1",
7+
"method": "sha256",
8+
"salt": "salt",
9+
"digest": "38ea2e5e88fcd692fe177c6cada15e9b2db6e70bee0a0d6678c8d3b2a9aae2ad"
10+
}
11+
,
12+
{
13+
# Authenticates user by client certificate
14+
"name": "u2",
15+
"method": "client_cert"
16+
}
17+
,
18+
{
19+
# Authenticates user by plain password
20+
"name": "u3",
21+
"method": "plain_password",
22+
"password": "insecure_plain_password_for_test"
23+
}
24+
,
25+
{
26+
# Handles all users that login without username / password
27+
"name": "anonymous",
28+
"method": "anonymous"
29+
}
30+
,
31+
{
32+
# Handles all users that are not authenticated (non-existing user, invalid password)
33+
"name": "unauthenticated",
34+
"method": "unauthenticated"
35+
}
36+
]
37+
,
38+
# Combine users into groups
39+
"groups": [
40+
{
41+
# Users can be combined into groups, group name starts with @
42+
"name": "@g1",
43+
"members": ["u1", "u2", "anonymous", "unauthenticated"]
44+
}
45+
]
46+
,
47+
# Give access to topics
48+
"authorization": [
49+
{
50+
# Specified users and groups are denied to publish on this topic
51+
"topic": "#",
52+
"deny": { "pub": ["@g1"] }
53+
}
54+
,
55+
{
56+
# Specified users and groups are denied to subscribe on this topic"
57+
"topic": "#",
58+
"deny": { "sub": ["@g1"] }
59+
}
60+
,
61+
{
62+
# Specified users and groups are allowed to subscribe and publish on this topic"
63+
"topic": "sub/#",
64+
"allow": {
65+
"sub": ["@g1"],
66+
"pub": ["@g1"]
67+
}
68+
}
69+
,
70+
{
71+
# Specified users and groups are denied to subscribe and publish on this topic
72+
"topic": "sub/topic1",
73+
"deny": {
74+
"sub": ["u1", "anonymous"],
75+
"pub": ["u1", "anonymous"]
76+
}
77+
}
78+
]
79+
}

0 commit comments

Comments
 (0)