Skip to content

Commit 963b1a0

Browse files
Test opaque tokens via amqp protocol
1 parent f7956bf commit 963b1a0

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

selenium/full-suite-authnz-messaging

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ authnz-messaging/auth-internal-backend.sh
77
authnz-messaging/auth-internal-mtls-backend.sh
88
authnz-messaging/auth-internal-http-backends.sh
99
authnz-messaging/auth-ldap-backend.sh
10+
authnz-messaging/auth-oauth-backend-with-devproducer.sh
11+
authnz-messaging/auth-oauth-backend-with-prodproducer.sh
12+
authnz-messaging/auth-oauth-backend-with-opaque-tokens.sh

selenium/test/amqp.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,21 @@ function getConnectionOptions() {
4141
}
4242
module.exports = {
4343
getAmqpConnectionOptions: () => { return connectionOptions },
44+
setAmqpConnectionOptions: (options) => { connectionOptions = options },
4445
getAmqpUrl: () => {
4546
return connectionOptions.scheme + '://' +
4647
connectionOptions.username + ":" + connectionOptions.password + "@" +
4748
connectionOptions.host + ":" + connectionOptions.port
4849
},
49-
open: (queueName = "my-queue", connOptions = connectionOptions) => {
50+
open: (queueName = "my-queue") => {
5051
let promise = new Promise((resolve, reject) => {
5152
container.on('connection_open', function(context) {
5253
resolve()
5354
})
5455
})
55-
console.log("Opening amqp connection using " + JSON.stringify(connOptions))
56+
console.log("Opening amqp connection using " + JSON.stringify(connectionOptions))
5657

57-
let connection = container.connect(connOptions)
58+
let connection = container.connect(connectionOptions)
5859
let receiver = connection.open_receiver({
5960
source: queueName,
6061
target: 'receiver-target',

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const assert = require('assert')
22
const { log, tokenFor, openIdConfiguration } = require('../utils')
33
const { reset, expectUser, expectVhost, expectResource, allow, verifyAll } = require('../mock_http_backend')
4-
const { getAmqpConnectionOptions: amqpOptions, open: openAmqp, once: onceAmqp, on: onAmqp, close: closeAmqp } = require('../amqp')
4+
const { getAmqpConnectionOptions: getAmqpOptions,
5+
setAmqpConnectionOptions: setAmqpOptions,
6+
open: openAmqp, once: onceAmqp, on: onAmqp, close: closeAmqp } = require('../amqp')
57

68
var receivedAmqpMessageCount = 0
79
var untilConnectionEstablished = new Promise((resolve, reject) => {
@@ -31,7 +33,7 @@ describe('Having AMQP 1.0 protocol enabled and the following auth_backends: ' +
3133
let password = process.env.RABBITMQ_AMQP_PASSWORD
3234
let usemtls = process.env.AMQP_USE_MTLS
3335
let amqp;
34-
let amqpSettings = amqpOptions()
36+
let amqpSettings = getAmqpOptions()
3537

3638
before(function () {
3739
if (backends.includes("http") && (username.includes("http") || usemtls)) {
@@ -55,14 +57,15 @@ describe('Having AMQP 1.0 protocol enabled and the following auth_backends: ' +
5557
log("oauthClientSecret : " + oauthClientSecret)
5658
let openIdConfig = openIdConfiguration(oauthProviderUrl)
5759
log("Obtained token_endpoint : " + openIdConfig.token_endpoint)
58-
password = tokenFor(oauthClientId, oauthClientSecret, openIdConfig.token_endpoint, tokenFormat)
60+
password = tokenFor(oauthClientId, oauthClientSecret, openIdConfig.token_endpoint)
5961
log("Obtained access token : " + password)
6062
amqpSettings.password = password
63+
setAmqpOptions(amqpSettings)
6164
}
6265
})
6366

6467
it('can open an AMQP 1.0 connection', async function () {
65-
amqp = openAmqp("mq-queue", amqpSettings)
68+
amqp = openAmqp()
6669
await untilConnectionEstablished
6770
var untilMessageReceived = new Promise((resolve, reject) => {
6871
onAmqp('message', function(context) {

0 commit comments

Comments
 (0)