Skip to content

Commit 414ad58

Browse files
MarcialRosalesmichaelklishin
authored andcommitted
Use correct user to authenticate
depending on the backend we want to exercise
1 parent fca55ce commit 414ad58

File tree

4 files changed

+34
-14
lines changed

4 files changed

+34
-14
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export RABBITMQ_AMQP_USERNAME=management
1+
export RABBITMQ_AMQP_USERNAME=internaluser
22
export RABBITMQ_AMQP_PASSWORD=management

deps/rabbitmq_management/selenium/test/authnz-msg-protocols/amqp10.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ for (const element of profiles.split(" ")) {
1313

1414
describe('Having AMQP 1.0 protocol enabled and the following auth_backends: ' + backends, function () {
1515
let expectations = []
16+
let username = process.env.RABBITMQ_AMQP_USERNAME
17+
let password = process.env.RABBITMQ_AMQP_PASSWORD
1618

1719
before(function () {
18-
if ( backends.includes("http") ) {
20+
if (backends.includes("http") && username.includes("http")) {
1921
reset()
20-
expectations.push(expectUser({ "username": "httpuser", "password": "httppassword" }, "allow"))
21-
expectations.push(expectVhost({ "username": "httpuser", "vhost": "/"}, "allow"))
22-
expectations.push(expectResource({ "username": "httpuser", "vhost": "/", "resource": "queue", "name": "my-queue", "permission":"configure", "tags":""}, "allow"))
23-
expectations.push(expectResource({ "username": "httpuser", "vhost": "/", "resource": "queue", "name": "my-queue", "permission":"read", "tags":""}, "allow"))
24-
expectations.push(expectResource({ "username": "httpuser", "vhost": "/", "resource": "exchange", "name": "amq.default", "permission":"write", "tags":""}, "allow"))
22+
expectations.push(expectUser({ "username": username, "password": password}, "allow"))
23+
expectations.push(expectVhost({ "username": username, "vhost": "/"}, "allow"))
24+
expectations.push(expectResource({ "username": username, "vhost": "/", "resource": "queue", "name": "my-queue", "permission":"configure", "tags":""}, "allow"))
25+
expectations.push(expectResource({ "username": username, "vhost": "/", "resource": "queue", "name": "my-queue", "permission":"read", "tags":""}, "allow"))
26+
expectations.push(expectResource({ "username": username, "vhost": "/", "resource": "exchange", "name": "amq.default", "permission":"write", "tags":""}, "allow"))
2527
}
2628
})
2729

deps/rabbitmq_management/selenium/test/authnz-msg-protocols/imports/users.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
"monitoring"
3737
],
3838
"limits": {}
39+
},
40+
{
41+
"name": "internaluser",
42+
"password_hash": "wefAAoRipS2ytWb7U2+BLhReT8oO+VU8ztUi3dv+rawi9rB1",
43+
"hashing_algorithm": "rabbit_password_hashing_sha256",
44+
"tags": [
45+
"management"
46+
],
47+
"limits": {}
3948
}
4049
],
4150
"vhosts": [
@@ -51,6 +60,13 @@
5160
"configure": ".*",
5261
"write": ".*",
5362
"read": ".*"
63+
},
64+
{
65+
"user": "internaluser",
66+
"vhost": "/",
67+
"configure": ".*",
68+
"write": ".*",
69+
"read": ".*"
5470
}
5571
]
5672

deps/rabbitmq_management/selenium/test/authnz-msg-protocols/mqtt.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ describe('Having MQTT protocol enbled and the following auth_backends: ' + backe
1616
let expectations = []
1717
let client_id = 'selenium-client'
1818
let rabbit = process.env.RABBITMQ_HOSTNAME || 'localhost'
19+
let username = process.env.RABBITMQ_AMQP_USERNAME
20+
let password = process.env.RABBITMQ_AMQP_PASSWORD
1921

2022
before(function () {
2123
mqttOptions = {
@@ -25,14 +27,14 @@ describe('Having MQTT protocol enbled and the following auth_backends: ' + backe
2527
keepalive: 10000,
2628
clean: false,
2729
reconnectPeriod: '1000',
28-
username: 'mqtt_u',
29-
password: 'mqtt_p',
30+
username: username,
31+
password: password,
3032
}
31-
if ( backends.includes("http") ) {
33+
if (backends.includes("http") && username.includes("http")) {
3234
reset()
33-
expectations.push(expectUser({ "username": "mqtt_u", "password": "mqtt_p", "client_id": client_id, "vhost": "/" }, "allow"))
34-
expectations.push(expectVhost({ "username": "mqtt_u", "vhost": "/"}, "allow"))
35-
expectations.push(expectResource({ "username": "mqtt_u", "vhost": "/", "resource": "queue", "name": "mqtt-will-selenium-client", "permission":"configure", "tags":"", "client_id" : client_id }, "allow"))
35+
expectations.push(expectUser({ "username": username, "password": password, "client_id": client_id, "vhost": "/" }, "allow"))
36+
expectations.push(expectVhost({ "username": username, "vhost": "/"}, "allow"))
37+
expectations.push(expectResource({ "username": username, "vhost": "/", "resource": "queue", "name": "mqtt-will-selenium-client", "permission":"configure", "tags":"", "client_id" : client_id }, "allow"))
3638
}
3739
})
3840

@@ -44,7 +46,7 @@ describe('Having MQTT protocol enbled and the following auth_backends: ' + backe
4446
})
4547
client.on('connect', function(err) {
4648
client.end()
47-
})
49+
})
4850
})
4951

5052
after(function () {

0 commit comments

Comments
 (0)