Merge pull request #4290 from murgatroid99/node_auth_plugin_param_change

Generalize metadata plugin arguments to future-proof it
pull/4301/head
Jan Tattermusch 9 years ago
commit 63b31dedf7
  1. 5
      src/node/src/credentials.js

@ -91,7 +91,7 @@ exports.createSsl = ChannelCredentials.createSsl;
*/ */
exports.createFromMetadataGenerator = function(metadata_generator) { exports.createFromMetadataGenerator = function(metadata_generator) {
return CallCredentials.createFromPlugin(function(service_url, callback) { return CallCredentials.createFromPlugin(function(service_url, callback) {
metadata_generator(service_url, function(error, metadata) { metadata_generator({service_url: service_url}, function(error, metadata) {
var code = grpc.status.OK; var code = grpc.status.OK;
var message = ''; var message = '';
if (error) { if (error) {
@ -114,7 +114,8 @@ exports.createFromMetadataGenerator = function(metadata_generator) {
* @return {CallCredentials} The resulting credentials object * @return {CallCredentials} The resulting credentials object
*/ */
exports.createFromGoogleCredential = function(google_credential) { exports.createFromGoogleCredential = function(google_credential) {
return exports.createFromMetadataGenerator(function(service_url, callback) { return exports.createFromMetadataGenerator(function(auth_context, callback) {
var service_url = auth_context.service_url;
google_credential.getRequestMetadata(service_url, function(err, header) { google_credential.getRequestMetadata(service_url, function(err, header) {
if (err) { if (err) {
callback(err); callback(err);

Loading…
Cancel
Save