aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-05-11 13:53:57 -0700
committerGravatar murgatroid99 <mlumish@google.com>2015-05-11 13:53:57 -0700
commit1b40198fb3fefd7591f025bc619d77165a43975f (patch)
tree354c3fad0913c81d29bf7329c163b46728d90e2f /src/node
parent903810191e19ef0d2bb593815b0b5277b3eb5487 (diff)
Added jwtaccess cloud-to-prod interop test
Diffstat (limited to 'src/node')
-rw-r--r--src/node/interop/interop_client.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js
index 02f341113d..0404b004b4 100644
--- a/src/node/interop/interop_client.js
+++ b/src/node/interop/interop_client.js
@@ -270,14 +270,15 @@ function cancelAfterFirstResponse(client, done) {
* Run one of the authentication tests.
* @param {string} expected_user The expected username in the response
* @param {Client} client The client to test against
+ * @param {?string} scope The scope to apply to the credentials
* @param {function} done Callback to call when the test is completed. Included
* primarily for use with mocha
*/
-function authTest(expected_user, client, done) {
+function authTest(expected_user, client, scope, done) {
(new GoogleAuth()).getApplicationDefault(function(err, credential) {
assert.ifError(err);
- if (credential.createScopedRequired()) {
- credential = credential.createScoped(AUTH_SCOPE);
+ if (credential.createScopedRequired() && scope) {
+ credential = credential.createScoped(scope);
}
client.updateMetadata = grpc.getGoogleAuthDelegate(credential);
var arg = {
@@ -318,8 +319,9 @@ var test_cases = {
empty_stream: emptyStream,
cancel_after_begin: cancelAfterBegin,
cancel_after_first_response: cancelAfterFirstResponse,
- compute_engine_creds: _.partial(authTest, COMPUTE_ENGINE_USER),
- service_account_creds: _.partial(authTest, AUTH_USER)
+ compute_engine_creds: _.partial(authTest, COMPUTE_ENGINE_USER, null),
+ service_account_creds: _.partial(authTest, AUTH_USER, AUTH_SCOPE),
+ jwt_token_creds: _.partial(authTest, AUTH_USER, null)
};
/**