diff options
author | murgatroid99 <mlumish@google.com> | 2015-08-12 10:48:39 -0700 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2015-08-12 10:48:39 -0700 |
commit | e87997faa2c99f58a57988f776d3b74be940c38a (patch) | |
tree | 964ba932d8a9f1b9ae0d368cf161aa476bb4795b /src | |
parent | bc447deaad50756c2e8253bc3347e1731321ddf1 (diff) |
Fixed failing cloud-to-prod auth interop tests
Diffstat (limited to 'src')
-rw-r--r-- | src/node/interop/interop_client.js | 6 | ||||
-rw-r--r-- | src/node/src/client.js | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 221d69e246..6152d4453b 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -298,7 +298,9 @@ function authTest(expected_user, scope, client, done) { assert.strictEqual(resp.payload.type, 'COMPRESSABLE'); assert.strictEqual(resp.payload.body.length, 314159); assert.strictEqual(resp.username, expected_user); - assert.strictEqual(resp.oauth_scope, AUTH_SCOPE_RESPONSE); + if (scope) { + assert.strictEqual(resp.oauth_scope, AUTH_SCOPE_RESPONSE); + } if (done) { done(); } @@ -335,7 +337,7 @@ function oauth2Test(expected_user, scope, per_rpc, client, done) { if (done) { done(); } - }); + }, client_metadata); }; if (per_rpc) { updateMetadata('', {}, makeTestCall); diff --git a/src/node/src/client.js b/src/node/src/client.js index b2b4423707..a253c86025 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -523,7 +523,7 @@ var requester_makers = { * requestSerialize: function to serialize request objects * responseDeserialize: function to deserialize response objects * @param {Object} methods An object mapping method names to method attributes - * @param {string} serviceName The name of the service + * @param {string} serviceName The fully qualified name of the service * @return {function(string, Object)} New client constructor */ exports.makeClientConstructor = function(methods, serviceName) { @@ -548,8 +548,10 @@ exports.makeClientConstructor = function(methods, serviceName) { } options['grpc.primary_user_agent'] = 'grpc-node/' + version; this.channel = new grpc.Channel(address, credentials, options); - this.server_address = address.replace(/\/$/, ''); - this.auth_uri = this.server_address + '/' + serviceName; + // Extract the DNS name from the address string + address = address.replace(/(\w+:\/\/)?([^:]+)(:\d+)?\/?$/, '$2'); + this.server_address = address; + this.auth_uri = 'https://' + this.server_address + '/' + serviceName; this.updateMetadata = updateMetadata; } @@ -587,7 +589,8 @@ exports.makeClientConstructor = function(methods, serviceName) { */ exports.makeProtobufClientConstructor = function(service) { var method_attrs = common.getProtobufServiceAttrs(service, service.name); - var Client = exports.makeClientConstructor(method_attrs); + var Client = exports.makeClientConstructor( + method_attrs, common.fullyQualifiedName(service)); Client.service = service; return Client; }; |