Use correct user to authenticate
depending on the backend we want to exercise
This commit is contained in:
		
							parent
							
								
									fca55cec9f
								
							
						
					
					
						commit
						414ad58de5
					
				|  | @ -1,2 +1,2 @@ | |||
| export RABBITMQ_AMQP_USERNAME=management | ||||
| export RABBITMQ_AMQP_USERNAME=internaluser | ||||
| export RABBITMQ_AMQP_PASSWORD=management | ||||
|  |  | |||
|  | @ -13,15 +13,17 @@ for (const element of profiles.split(" ")) { | |||
| 
 | ||||
| describe('Having AMQP 1.0 protocol enabled and the following auth_backends: ' + backends, function () { | ||||
|   let expectations = [] | ||||
|   let username = process.env.RABBITMQ_AMQP_USERNAME | ||||
|   let password = process.env.RABBITMQ_AMQP_PASSWORD | ||||
| 
 | ||||
|   before(function () { | ||||
|     if ( backends.includes("http") ) { | ||||
|     if (backends.includes("http") && username.includes("http")) { | ||||
|       reset() | ||||
|       expectations.push(expectUser({ "username": "httpuser", "password": "httppassword" }, "allow")) | ||||
|       expectations.push(expectVhost({ "username": "httpuser", "vhost": "/"}, "allow")) | ||||
|       expectations.push(expectResource({ "username": "httpuser", "vhost": "/", "resource": "queue", "name": "my-queue", "permission":"configure", "tags":""}, "allow")) | ||||
|       expectations.push(expectResource({ "username": "httpuser", "vhost": "/", "resource": "queue", "name": "my-queue", "permission":"read", "tags":""}, "allow")) | ||||
|       expectations.push(expectResource({ "username": "httpuser", "vhost": "/", "resource": "exchange", "name": "amq.default", "permission":"write", "tags":""}, "allow")) | ||||
|       expectations.push(expectUser({ "username": username, "password": password}, "allow")) | ||||
|       expectations.push(expectVhost({ "username": username, "vhost": "/"}, "allow")) | ||||
|       expectations.push(expectResource({ "username": username, "vhost": "/", "resource": "queue", "name": "my-queue", "permission":"configure", "tags":""}, "allow")) | ||||
|       expectations.push(expectResource({ "username": username, "vhost": "/", "resource": "queue", "name": "my-queue", "permission":"read", "tags":""}, "allow")) | ||||
|       expectations.push(expectResource({ "username": username, "vhost": "/", "resource": "exchange", "name": "amq.default", "permission":"write", "tags":""}, "allow")) | ||||
|     } | ||||
|   }) | ||||
| 
 | ||||
|  |  | |||
|  | @ -36,6 +36,15 @@ | |||
|         "monitoring" | ||||
|       ], | ||||
|       "limits": {} | ||||
|     }, | ||||
|     { | ||||
|       "name": "internaluser", | ||||
|       "password_hash": "wefAAoRipS2ytWb7U2+BLhReT8oO+VU8ztUi3dv+rawi9rB1", | ||||
|       "hashing_algorithm": "rabbit_password_hashing_sha256", | ||||
|       "tags": [ | ||||
|         "management" | ||||
|       ], | ||||
|       "limits": {} | ||||
|     } | ||||
|   ], | ||||
|   "vhosts": [ | ||||
|  | @ -51,6 +60,13 @@ | |||
|       "configure": ".*", | ||||
|       "write": ".*", | ||||
|       "read": ".*" | ||||
|     }, | ||||
|     { | ||||
|       "user": "internaluser", | ||||
|       "vhost": "/", | ||||
|       "configure": ".*", | ||||
|       "write": ".*", | ||||
|       "read": ".*" | ||||
|     } | ||||
|   ] | ||||
| 
 | ||||
|  |  | |||
|  | @ -16,6 +16,8 @@ describe('Having MQTT protocol enbled and the following auth_backends: ' + backe | |||
|   let expectations = [] | ||||
|   let client_id = 'selenium-client' | ||||
|   let rabbit = process.env.RABBITMQ_HOSTNAME || 'localhost' | ||||
|   let username = process.env.RABBITMQ_AMQP_USERNAME | ||||
|   let password = process.env.RABBITMQ_AMQP_PASSWORD | ||||
| 
 | ||||
|   before(function () { | ||||
|     mqttOptions = { | ||||
|  | @ -25,14 +27,14 @@ describe('Having MQTT protocol enbled and the following auth_backends: ' + backe | |||
|       keepalive: 10000, | ||||
|       clean: false, | ||||
|       reconnectPeriod: '1000', | ||||
|       username: 'mqtt_u', | ||||
|       password: 'mqtt_p', | ||||
|       username: username, | ||||
|       password: password, | ||||
|     } | ||||
|     if ( backends.includes("http") ) { | ||||
|     if (backends.includes("http") && username.includes("http")) { | ||||
|       reset() | ||||
|       expectations.push(expectUser({ "username": "mqtt_u", "password": "mqtt_p", "client_id": client_id, "vhost": "/" }, "allow")) | ||||
|       expectations.push(expectVhost({ "username": "mqtt_u", "vhost": "/"}, "allow")) | ||||
|       expectations.push(expectResource({ "username": "mqtt_u", "vhost": "/", "resource": "queue", "name": "mqtt-will-selenium-client", "permission":"configure", "tags":"", "client_id" : client_id }, "allow")) | ||||
|       expectations.push(expectUser({ "username": username, "password": password, "client_id": client_id, "vhost": "/" }, "allow")) | ||||
|       expectations.push(expectVhost({ "username": username, "vhost": "/"}, "allow")) | ||||
|       expectations.push(expectResource({ "username": username, "vhost": "/", "resource": "queue", "name": "mqtt-will-selenium-client", "permission":"configure", "tags":"", "client_id" : client_id }, "allow")) | ||||
|     } | ||||
|   }) | ||||
| 
 | ||||
|  | @ -44,7 +46,7 @@ describe('Having MQTT protocol enbled and the following auth_backends: ' + backe | |||
|     }) | ||||
|     client.on('connect', function(err) { | ||||
|       client.end() | ||||
|     })     | ||||
|     }) | ||||
|   }) | ||||
| 
 | ||||
|   after(function () { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue