Permalink
Browse files

Merge pull request #3 from andrerod/connect

Connect
  • Loading branch information...
2 parents 0926b81 + e9eaa4a commit 32cf01fd20df3a0a90f773475190ab7a8c4c28f1 André Rodrigues committed Oct 10, 2012
@@ -59,7 +59,7 @@ function ServiceBusService(namespaceOrConnectionString, accessKey, issuer, acsNa
}
var namespace = namespaceOrConnectionString;
- if (namespaceOrConnectionString && accessKey === undefined) {
+ if (namespaceOrConnectionString && !accessKey) {
// If namespaceOrConnectionString was passed and no accessKey was passed, assume connection string
var connectionString = ConnectionStringParser.parse(namespaceOrConnectionString);
if (connectionString['endpoint']) {
@@ -75,6 +75,11 @@ function ServiceBusService(namespaceOrConnectionString, accessKey, issuer, acsNa
if (connectionString['sharedsecretvalue']) {
accessKey = connectionString['sharedsecretvalue'];
}
+
+ if (connectionString['stsendpoint']) {
+ var endpoint = url.parse(connectionString['stsendpoint']);
+ acsNamespace = endpoint.host.split('.')[0];
+ }
}
ServiceBusService.super_.call(this, host, namespace, accessKey, issuer, acsNamespace, authenticationProvider);
@@ -1608,13 +1608,14 @@ suite('servicebusservice-tests', function () {
});
test('connectionStrings', function (done) {
- var connectionString = 'Endpoint=sb://ablal-martvue.servicebus.windows.net/;SharedSecretIssuer=owner;SharedSecretValue=value';
+ var connectionString = 'Endpoint=sb://ablal-martvue.servicebus.windows.net/;StsEndpoint=https://ablal-martvue-sb.accesscontrol.windows.net;SharedSecretIssuer=owner;SharedSecretValue=value';
var serviceBusService = azure.createServiceBusService(connectionString);
assert.equal(serviceBusService.host, 'servicebus.windows.net');
assert.equal(serviceBusService.namespace, 'ablal-martvue');
assert.equal(serviceBusService.issuer, 'owner');
assert.equal(serviceBusService.accessKey, 'value');
+ assert.equal(serviceBusService.acsNamespace, 'ablal-martvue-sb');
done();
});

0 comments on commit 32cf01f

Please sign in to comment.