From 8490e832c3739cb7cc1281eb1ea1d97f452a98aa Mon Sep 17 00:00:00 2001
From: Danny Hermes
Date: Wed, 2 Sep 2015 12:50:42 -0700
Subject: [PATCH 1/2] Changing all uses of authorization to authentication.
---
README.md | 40 +++---
docs/authorization.md | 2 +-
docs/faq.md | 6 +-
docs/index.html | 2 +-
.../authorization/authorization.html | 14 +-
.../components/authorization/authorization.js | 10 +-
docs/site/components/docs/docs.html | 2 +-
.../language-switcher/language-switcher.html | 4 +-
docs/site/components/subpage/subpage.html | 4 +-
docs/site/home.html | 2 +-
docs/site/home.js | 2 +-
lib/bigquery/index.js | 4 +-
lib/bigquery/table.js | 2 +-
lib/common/util.js | 50 +++----
lib/compute/index.js | 4 +-
lib/datastore/dataset.js | 2 +-
lib/datastore/request.js | 10 +-
lib/datastore/transaction.js | 4 +-
lib/dns/index.js | 4 +-
lib/index.js | 2 +-
lib/pubsub/index.js | 4 +-
lib/search/index.js | 4 +-
lib/storage/bucket.js | 4 +-
lib/storage/file.js | 14 +-
lib/storage/index.js | 4 +-
test/bigquery/index.js | 4 +-
test/common/util.js | 126 +++++++++---------
test/compute/index.js | 12 +-
test/datastore/request.js | 16 +--
test/datastore/transaction.js | 8 +-
test/dns/index.js | 22 +--
test/pubsub/index.js | 2 +-
test/search/index.js | 22 +--
test/storage/bucket.js | 30 ++---
test/storage/file.js | 34 ++---
35 files changed, 238 insertions(+), 238 deletions(-)
diff --git a/README.md b/README.md
index 1e056347fa9..6ba2a0c3893 100644
--- a/README.md
+++ b/README.md
@@ -33,16 +33,16 @@ $ npm install --save gcloud
- [gcloud-kvstore][gcloud-kvstore] - Use Datastore as a simple key-value store.
- [hya-wave][hya-wave] - Cloud-based web sample editor. Part of the [hya-io][hya-io] family of products.
-## Authorization
+## Authentication
-With `gcloud-node` it's incredibly easy to get authorized and start using Google's APIs. You can set your credentials on a global basis as well as on a per-API basis. See each individual API section below to see how you can auth on a per-API-basis. This is useful if you want to use different accounts for different Google Cloud services.
+With `gcloud-node` it's incredibly easy to get authenticated and start using Google's APIs. You can set your credentials on a global basis as well as on a per-API basis. See each individual API section below to see how you can auth on a per-API-basis. This is useful if you want to use different accounts for different Google Cloud services.
### On Google Compute Engine
-If you are running this client on Google Compute Engine, we handle authorization for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access.
+If you are running this client on Google Compute Engine, we handle authentication for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access.
``` js
-// Authorizing on a global basis.
+// Authenticating on a global basis.
var projectId = process.env.GCLOUD_PROJECT_ID; // E.g. 'grape-spaceship-123'
var gcloud = require('gcloud')({
projectId: projectId
@@ -62,11 +62,11 @@ If you are not running this client on Google Compute Engine, you need a Google D
* Google Cloud Storage
* Google Cloud Storage JSON API
4. Navigate to **APIs & auth** > **Credentials** and then:
- * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authorize your requests.
+ * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests.
* If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file.
``` js
-// Authorizing on a global basis.
+// Authenticating on a global basis.
var projectId = process.env.GCLOUD_PROJECT_ID; // E.g. 'grape-spaceship-123'
var gcloud = require('gcloud')({
@@ -90,8 +90,8 @@ You can also set auth on a per-API-instance basis. The examples below show you h
```js
var gcloud = require('gcloud');
-// Authorizing on a per-API-basis. You don't need to do this if you auth on a
-// global basis (see Authorization section above).
+// Authenticating on a per-API-basis. You don't need to do this if you auth on a
+// global basis (see Authentication section above).
var bigquery = gcloud.bigquery({
projectId: 'my-project',
keyFilename: '/path/to/keyfile.json'
@@ -126,8 +126,8 @@ job.getQueryResults().on('data', function(row) {});
```js
var gcloud = require('gcloud');
-// Authorizing on a per-API-basis. You don't need to do this if you auth on a
-// global basis (see Authorization section above).
+// Authenticating on a per-API-basis. You don't need to do this if you auth on a
+// global basis (see Authentication section above).
var dataset = gcloud.datastore.dataset({
projectId: 'my-project',
@@ -177,8 +177,8 @@ dataset.save({
```js
var gcloud = require('gcloud');
-// Authorizing on a per-API-basis. You don't need to do this if you auth on a
-// global basis (see Authorization section above).
+// Authenticating on a per-API-basis. You don't need to do this if you auth on a
+// global basis (see Authentication section above).
var dns = gcloud.dns({
keyFilename: '/path/to/keyfile.json',
@@ -217,8 +217,8 @@ zone.export('/zonefile.zone', function(err) {});
```js
var gcloud = require('gcloud');
-// Authorizing on a per-API-basis. You don't need to do this if you
-// auth on a global basis (see Authorization section above).
+// Authenticating on a per-API-basis. You don't need to do this if you
+// auth on a global basis (see Authentication section above).
var pubsub = gcloud.pubsub({
projectId: 'my-project',
@@ -260,8 +260,8 @@ topic.subscribe('new-subscription', function(err, subscription) {
var fs = require('fs');
var gcloud = require('gcloud');
-// Authorizing on a per-API-basis. You don't need to do this if you auth on a
-// global basis (see Authorization section above).
+// Authenticating on a per-API-basis. You don't need to do this if you auth on a
+// global basis (see Authentication section above).
var gcs = gcloud.storage({
keyFilename: '/path/to/keyfile.json',
@@ -311,8 +311,8 @@ localReadStream.pipe(remoteWriteStream);
```js
var gcloud = require('gcloud');
-// Authorizing on a per-API-basis. You don't need to do this if you auth on a
-// global basis (see Authorization section above).
+// Authenticating on a per-API-basis. You don't need to do this if you auth on a
+// global basis (see Authentication section above).
var gce = gcloud.compute({
projectId: 'my-project',
@@ -347,8 +347,8 @@ zone.createVM(name, { os: 'ubuntu' }, function(err, vm, operation) {
```js
var gcloud = require('gcloud');
-// Authorizing on a per-API-basis. You don't need to do this if you auth on a
-// global basis (see Authorization section above).
+// Authenticating on a per-API-basis. You don't need to do this if you auth on a
+// global basis (see Authentication section above).
var search = gcloud.search({
keyFilename: '/path/to/keyfile.json',
diff --git a/docs/authorization.md b/docs/authorization.md
index 1a9e149f7a7..468b5aaa598 100644
--- a/docs/authorization.md
+++ b/docs/authorization.md
@@ -1,6 +1,6 @@
## With `gcloud-node`
-With `gcloud-node` it's incredibly easy to get authorized and start using Google's APIs. You can set your credentials on a global basis as well as on a per-API basis. See each individual API section below to see how you can auth on a per-API-basis. This is useful if you want to use different accounts for different Google Cloud services.
+With `gcloud-node` it's incredibly easy to get authenticated and start using Google's APIs. You can set your credentials on a global basis as well as on a per-API basis. See each individual API section below to see how you can auth on a per-API-basis. This is useful if you want to use different accounts for different Google Cloud services.
```hljs-class
var config = {
diff --git a/docs/faq.md b/docs/faq.md
index beaf7908523..44f5c505074 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -1,10 +1,10 @@
## How do I use `gcloud` with Google Compute Engine?
-If you are running this client on Google Compute Engine, we handle authorization for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access.
+If you are running this client on Google Compute Engine, we handle authentication for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access.
## I'm not using Compute Engine. What do I need to do?
-If you are not running this client on Google Compute Engine, you need a Google Developers service account. To create a service account, please see our [Authorization][auth-guide] guide.
+If you are not running this client on Google Compute Engine, you need a Google Developers service account. To create a service account, please see our [Authentication][auth-guide] guide.
## Does this replace [Google Cloud Node.js Client][googleapis]?
@@ -13,4 +13,4 @@ Google Cloud Node.js Client is a client library for using the broad set of Googl
[dev-console]: https://console.developers.google.com/project
[gce-how-to]: https://developers.google.com/compute/docs/authentication#using
[googleapis]: https://github.com/google/google-api-nodejs-client
-[auth-guide]: #/authorization
+[auth-guide]: #/authentication
diff --git a/docs/index.html b/docs/index.html
index ab91e64d5f4..7ccee7fe3cb 100755
--- a/docs/index.html
+++ b/docs/index.html
@@ -36,7 +36,7 @@
-
+
diff --git a/docs/site/components/authorization/authorization.html b/docs/site/components/authorization/authorization.html
index be36048a1db..fd7d64acdd7 100644
--- a/docs/site/components/authorization/authorization.html
+++ b/docs/site/components/authorization/authorization.html
@@ -1,8 +1,8 @@
-
+ header-templateUrl="authentication-header.html"
+ title="Authentication">
+ gcloud-markdown="https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/readme.md">
-
+
diff --git a/docs/site/components/authorization/authorization.js b/docs/site/components/authorization/authorization.js
index 172c2e007f4..16ef14a0030 100644
--- a/docs/site/components/authorization/authorization.js
+++ b/docs/site/components/authorization/authorization.js
@@ -1,16 +1,16 @@
angular
- .module('gcloud.authorization', ['ngRoute', 'gcloud.subpage', 'gcloud.markdown'])
+ .module('gcloud.authentication', ['ngRoute', 'gcloud.subpage', 'gcloud.markdown'])
.config(function($routeProvider) {
'use strict';
- $routeProvider.when('/authorization', {
- controller: 'AuthorizationCtrl',
- templateUrl: 'site/components/authorization/authorization.html',
+ $routeProvider.when('/authentication', {
+ controller: 'AuthenticationCtrl',
+ templateUrl: 'site/components/authentication/authentication.html',
reloadOnSearch: false
});
})
- .controller('AuthorizationCtrl', function($scope) {
+ .controller('AuthenticationCtrl', function($scope) {
'use strict';
});
diff --git a/docs/site/components/docs/docs.html b/docs/site/components/docs/docs.html
index 1d94fa00dbd..f847c3c4dcb 100644
--- a/docs/site/components/docs/docs.html
+++ b/docs/site/components/docs/docs.html
@@ -39,7 +39,7 @@
keyFilename: '/path/to/keyfile.json'
});
- The full set of options which can be passed to gcloud and sub-modules are outlined here.
+ The full set of options which can be passed to gcloud and sub-modules are outlined here.
diff --git a/docs/site/components/language-switcher/language-switcher.html b/docs/site/components/language-switcher/language-switcher.html
index c04be040b82..50221f09ef8 100644
--- a/docs/site/components/language-switcher/language-switcher.html
+++ b/docs/site/components/language-switcher/language-switcher.html
@@ -7,8 +7,8 @@
Getting Started
-
- Authorization
+
+ Authentication
diff --git a/docs/site/components/subpage/subpage.html b/docs/site/components/subpage/subpage.html
index cf66c49466c..6c26a13b0e0 100644
--- a/docs/site/components/subpage/subpage.html
+++ b/docs/site/components/subpage/subpage.html
@@ -58,8 +58,8 @@
Getting Started
-
- Authorization
+
+ Authentication
diff --git a/docs/site/home.html b/docs/site/home.html
index 202dad40e68..d4eec3f2328 100755
--- a/docs/site/home.html
+++ b/docs/site/home.html
@@ -76,7 +76,7 @@ What is it?
to you.
gcloud
is configured to access Google Cloud Platform
- services and authorize (OAuth 2.0) automatically on your behalf.
+ services and authenticate (OAuth 2.0) automatically on your behalf.
With a one-line install and a private key, you are up and ready
to go. Better yet, if you are running on a Google Compute Engine
instance, the one-line install is enough!
diff --git a/docs/site/home.js b/docs/site/home.js
index 026d05e30fb..041e33d7407 100644
--- a/docs/site/home.js
+++ b/docs/site/home.js
@@ -1,7 +1,7 @@
angular
.module('gcloud', [
'ngRoute',
- 'gcloud.authorization',
+ 'gcloud.authentication',
'gcloud.docs',
'gcloud.faq',
'gcloud.contributing',
diff --git a/lib/bigquery/index.js b/lib/bigquery/index.js
index 42d36873cb2..db34d9516b7 100644
--- a/lib/bigquery/index.js
+++ b/lib/bigquery/index.js
@@ -105,7 +105,7 @@ function BigQuery(options) {
throw util.missingProjectIdError;
}
- this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory({
+ this.makeAuthenticatedRequest_ = util.makeAuthenticatedRequestFactory({
credentials: options.credentials,
keyFile: options.keyFilename,
scopes: SCOPES,
@@ -627,7 +627,7 @@ BigQuery.prototype.makeReq_ = function(method, path, query, body, callback) {
reqOpts.json = body;
}
- this.makeAuthorizedRequest_(reqOpts, callback);
+ this.makeAuthenticatedRequest_(reqOpts, callback);
};
/*! Developer Documentation
diff --git a/lib/bigquery/table.js b/lib/bigquery/table.js
index 3bf10e86cbf..c0a21e95026 100644
--- a/lib/bigquery/table.js
+++ b/lib/bigquery/table.js
@@ -311,7 +311,7 @@ Table.prototype.createWriteStream = function(metadata) {
dup.once('writing', function() {
util.makeWritableStream(dup, {
- makeAuthorizedRequest: that.bigQuery.makeAuthorizedRequest_,
+ makeAuthenticatedRequest: that.bigQuery.makeAuthenticatedRequest_,
metadata: {
configuration: {
load: metadata
diff --git a/lib/common/util.js b/lib/common/util.js
index 1bbdd0a47d7..18c46884f00 100644
--- a/lib/common/util.js
+++ b/lib/common/util.js
@@ -44,8 +44,8 @@ var util = module.exports;
var missingProjectIdError = new Error([
'Sorry, we cannot connect to Google Cloud Services without a project ID.',
- 'See https://googlecloudplatform.github.io/gcloud-node/#/authorization for',
- 'a detailed guide on creating an authorized connection.'
+ 'See https://googlecloudplatform.github.io/gcloud-node/#/authentication for',
+ 'a detailed guide on creating an authenticated connection.'
].join(' '));
util.missingProjectIdError = missingProjectIdError;
@@ -193,7 +193,7 @@ function parseApiResp(err, resp, body) {
util.parseApiResp = parseApiResp;
/**
- * Take a Duplexify stream, fetch an authorized connection header, and create an
+ * Take a Duplexify stream, fetch an authenticated connection header, and create an
* outgoing writable stream.
*
* @param {Duplexify} dup - Duplexify stream.
@@ -240,14 +240,14 @@ function makeWritableStream(dup, options, onComplete) {
]
});
- options.makeAuthorizedRequest(reqOpts, {
- onAuthorized: function(err, authorizedReqOpts) {
+ options.makeAuthenticatedRequest(reqOpts, {
+ onAuthenticated: function(err, authenticatedReqOpts) {
if (err) {
dup.destroy(err);
return;
}
- request(authorizedReqOpts, function(err, resp, body) {
+ request(authenticatedReqOpts, function(err, resp, body) {
util.handleResp(err, resp, body, function(err, data) {
if (err) {
dup.destroy(err);
@@ -295,7 +295,7 @@ function shouldRetryRequest(err) {
util.shouldRetryRequest = shouldRetryRequest;
/**
- * Get a function for making authorized requests.
+ * Get a function for making authenticated requests.
*
* @param {object} config - Configuration object.
* @param {boolean=} config.autoRetry - Automatically retry requests if the
@@ -312,22 +312,22 @@ util.shouldRetryRequest = shouldRetryRequest;
* @param {string=} config.keyFile - Path to a .json, .pem, or .p12 keyfile.
* @param {array} config.scopes - Array of scopes required for the API.
*/
-function makeAuthorizedRequestFactory(config) {
+function makeAuthenticatedRequestFactory(config) {
config = config || {};
var authClient = googleAuth(config);
/**
- * The returned function that will make an authorized request.
+ * The returned function that will make an authenticated request.
*
* @param {type} reqOpts - Request options in the format `request` expects.
* @param {object|function} options - Configuration object or callback
* function.
- * @param {function=} options.onAuthorized - If provided, a request will not
- * be made. Instead, this function is passed the error & authorized
+ * @param {function=} options.onAuthenticated - If provided, a request will not
+ * be made. Instead, this function is passed the error & authenticated
* request options.
*/
- function makeAuthorizedRequest(reqOpts, options) {
+ function makeAuthenticatedRequest(reqOpts, options) {
var stream;
var reqConfig = extend({}, config);
@@ -336,38 +336,38 @@ function makeAuthorizedRequestFactory(config) {
reqConfig.stream = stream;
}
- function onAuthorized(err, authorizedReqOpts) {
+ function onAuthenticated(err, authenticatedReqOpts) {
// google-auth-library returns a "Could not load..." error if it can't get
// an access token. However, it's possible an API request doesn't need to
// be authenticated, e.g. when downloading a file from a public bucket. We
// consider this error a warning, and allow the request to go through
- // without authorization, relying on the upstream API to return an error
+ // without authentication, relying on the upstream API to return an error
// the user would find more helpful, should one occur.
if (err && err.message.indexOf('Could not load') === -1) {
if (stream) {
stream.destroy(err);
} else {
- (options.onAuthorized || options)(err);
+ (options.onAuthenticated || options)(err);
}
return;
}
- authorizedReqOpts = util.decorateRequest(authorizedReqOpts);
+ authenticatedReqOpts = util.decorateRequest(authenticatedReqOpts);
- if (options && options.onAuthorized) {
- options.onAuthorized(null, authorizedReqOpts);
+ if (options && options.onAuthenticated) {
+ options.onAuthenticated(null, authenticatedReqOpts);
} else {
- util.makeRequest(authorizedReqOpts, reqConfig, options);
+ util.makeRequest(authenticatedReqOpts, reqConfig, options);
}
}
if (reqConfig.customEndpoint) {
// Using a custom API override. Do not use `google-auto-auth` for
// authentication. (ex: connecting to a local Datastore server)
- onAuthorized(null, reqOpts);
+ onAuthenticated(null, reqOpts);
} else {
- authClient.authorizeRequest(reqOpts, onAuthorized);
+ authClient.authenticateRequest(reqOpts, onAuthenticated);
}
if (stream) {
@@ -375,15 +375,15 @@ function makeAuthorizedRequestFactory(config) {
}
}
- makeAuthorizedRequest.getCredentials =
+ makeAuthenticatedRequest.getCredentials =
authClient.getCredentials.bind(authClient);
- makeAuthorizedRequest.authClient = authClient;
+ makeAuthenticatedRequest.authClient = authClient;
- return makeAuthorizedRequest;
+ return makeAuthenticatedRequest;
}
-util.makeAuthorizedRequestFactory = makeAuthorizedRequestFactory;
+util.makeAuthenticatedRequestFactory = makeAuthenticatedRequestFactory;
/**
* Make a request through the `retryRequest` module with built-in error handling
diff --git a/lib/compute/index.js b/lib/compute/index.js
index eed2cb9bc44..6718768650b 100644
--- a/lib/compute/index.js
+++ b/lib/compute/index.js
@@ -125,7 +125,7 @@ function Compute(options) {
// We store the authConfig for use with gceImages in Zone.
this.authConfig = authConfig;
- this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory(authConfig);
+ this.makeAuthenticatedRequest_ = util.makeAuthenticatedRequestFactory(authConfig);
this.projectId = options.projectId;
}
@@ -1368,7 +1368,7 @@ Compute.prototype.makeReq_ = function(method, path, query, body, callback) {
reqOpts.json = body;
}
- this.makeAuthorizedRequest_(reqOpts, callback);
+ this.makeAuthenticatedRequest_(reqOpts, callback);
};
/*! Developer Documentation
diff --git a/lib/datastore/dataset.js b/lib/datastore/dataset.js
index 2c5f988562f..c22296e4ee4 100644
--- a/lib/datastore/dataset.js
+++ b/lib/datastore/dataset.js
@@ -110,7 +110,7 @@ function Dataset(options) {
throw util.missingProjectIdError;
}
- this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory({
+ this.makeAuthenticatedRequest_ = util.makeAuthenticatedRequestFactory({
customEndpoint: typeof options.apiEndpoint !== 'undefined',
credentials: options.credentials,
keyFile: options.keyFilename,
diff --git a/lib/datastore/request.js b/lib/datastore/request.js
index f9ff6b14a71..38f602213f8 100644
--- a/lib/datastore/request.js
+++ b/lib/datastore/request.js
@@ -779,17 +779,17 @@ DatastoreRequest.prototype.makeReq_ = function(method, body, callback) {
}
};
- this.makeAuthorizedRequest_(reqOpts, {
- onAuthorized: function(err, authorizedReqOpts) {
+ this.makeAuthenticatedRequest_(reqOpts, {
+ onAuthenticated: function(err, authenticatedReqOpts) {
if (err) {
callback(err, null); // TODO(ryanseys): What goes as third parameter?
return;
}
- authorizedReqOpts.headers = authorizedReqOpts.headers || {};
- authorizedReqOpts.headers['Content-Length'] = pbRequest.length;
+ authenticatedReqOpts.headers = authenticatedReqOpts.headers || {};
+ authenticatedReqOpts.headers['Content-Length'] = pbRequest.length;
- var apiRequest = request(authorizedReqOpts);
+ var apiRequest = request(authenticatedReqOpts);
apiRequest.on('error', callback);
diff --git a/lib/datastore/transaction.js b/lib/datastore/transaction.js
index 91f79187046..29a40e91ac8 100644
--- a/lib/datastore/transaction.js
+++ b/lib/datastore/transaction.js
@@ -39,7 +39,7 @@ var extend = require('extend');
/*! Developer Documentation
*
- * @param {module:common/connection#Connection} connection - An authorized
+ * @param {module:common/connection#Connection} connection - An authenticated
* connection to Google Cloud Datastore.
* @param {string} projectId - Dataset ID. This is your project ID from the
* Google Developers Console.
@@ -72,7 +72,7 @@ var extend = require('extend');
function Transaction(dataset, projectId) {
this.id = null;
this.apiEndpoint = dataset.apiEndpoint;
- this.makeAuthorizedRequest_ = dataset.makeAuthorizedRequest_;
+ this.makeAuthenticatedRequest_ = dataset.makeAuthenticatedRequest_;
this.projectId = projectId;
// A queue for entity modifications made during the transaction.
diff --git a/lib/dns/index.js b/lib/dns/index.js
index cc1f12dbae8..9d711783fa2 100644
--- a/lib/dns/index.js
+++ b/lib/dns/index.js
@@ -87,7 +87,7 @@ function DNS(options) {
throw util.missingProjectIdError;
}
- this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory({
+ this.makeAuthenticatedRequest_ = util.makeAuthenticatedRequestFactory({
credentials: options.credentials,
keyFile: options.keyFilename,
scopes: SCOPES,
@@ -244,7 +244,7 @@ DNS.prototype.makeReq_ = function(method, path, query, body, callback) {
reqOpts.json = body;
}
- this.makeAuthorizedRequest_(reqOpts, callback);
+ this.makeAuthenticatedRequest_(reqOpts, callback);
};
/*! Developer Documentation
diff --git a/lib/index.js b/lib/index.js
index a3537d1b511..e831a83a53e 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -196,7 +196,7 @@ var scopedApis = {
* 2. Provide them at the time of instantiation of sub-modules, e.g. a Datastore
* dataset, a Cloud Storage bucket, etc.
*
- * See our [Authorization Guide](#/authorization) for how to obtain the
+ * See our [Authentication Guide](#/authentication) for how to obtain the
* necessary credentials for connecting to your project.
*
* @alias module:gcloud
diff --git a/lib/pubsub/index.js b/lib/pubsub/index.js
index adb0a7cc356..7556b8f07e8 100644
--- a/lib/pubsub/index.js
+++ b/lib/pubsub/index.js
@@ -91,7 +91,7 @@ function PubSub(options) {
throw util.missingProjectIdError;
}
- this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory({
+ this.makeAuthenticatedRequest_ = util.makeAuthenticatedRequestFactory({
credentials: options.credentials,
keyFile: options.keyFilename,
scopes: SCOPES,
@@ -543,7 +543,7 @@ PubSub.prototype.makeReq_ = function(method, path, q, body, callback) {
reqOpts.json = body;
}
- this.makeAuthorizedRequest_(reqOpts, callback);
+ this.makeAuthenticatedRequest_(reqOpts, callback);
};
/*! Developer Documentation
diff --git a/lib/search/index.js b/lib/search/index.js
index 9b57db1e56e..8b93c2532da 100644
--- a/lib/search/index.js
+++ b/lib/search/index.js
@@ -90,7 +90,7 @@ function Search(options) {
throw util.missingProjectIdError;
}
- this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory({
+ this.makeAuthenticatedRequest_ = util.makeAuthenticatedRequestFactory({
credentials: options.credentials,
email: options.email,
keyFile: options.keyFilename,
@@ -250,7 +250,7 @@ Search.prototype.makeReq_ = function(method, path, query, body, callback) {
reqOpts.json = body;
}
- this.makeAuthorizedRequest_(reqOpts, callback);
+ this.makeAuthenticatedRequest_(reqOpts, callback);
};
/*! Developer Documentation
diff --git a/lib/storage/bucket.js b/lib/storage/bucket.js
index 027eacb6e71..0a046a7e9ed 100644
--- a/lib/storage/bucket.js
+++ b/lib/storage/bucket.js
@@ -269,7 +269,7 @@ Bucket.prototype.combine = function(sources, destination, callback) {
}
}
- this.storage.makeAuthorizedRequest_({
+ this.storage.makeAuthenticatedRequest_({
method: 'POST',
uri: format('{base}/{destBucket}/o/{destFile}/compose', {
base: STORAGE_BASE_URL,
@@ -1105,7 +1105,7 @@ Bucket.prototype.makeReq_ = function(method, path, query, body, callback) {
reqOpts.json = body;
}
- this.storage.makeAuthorizedRequest_(reqOpts, callback);
+ this.storage.makeAuthenticatedRequest_(reqOpts, callback);
};
/*! Developer Documentation
diff --git a/lib/storage/file.js b/lib/storage/file.js
index cecb109af6c..4e1a8ed4cc7 100644
--- a/lib/storage/file.js
+++ b/lib/storage/file.js
@@ -470,7 +470,7 @@ File.prototype.createReadStream = function(options) {
};
}
- var requestStream = self.bucket.storage.makeAuthorizedRequest_(reqOpts);
+ var requestStream = self.bucket.storage.makeAuthenticatedRequest_(reqOpts);
var validateStream;
// We listen to the response event from the request stream so that we can...
@@ -1012,9 +1012,9 @@ File.prototype.getSignedPolicy = function(options, callback) {
conditions: conditions
};
- var makeAuthorizedRequest_ = this.bucket.storage.makeAuthorizedRequest_;
+ var makeAuthenticatedRequest_ = this.bucket.storage.makeAuthenticatedRequest_;
- makeAuthorizedRequest_.getCredentials(function(err, credentials) {
+ makeAuthenticatedRequest_.getCredentials(function(err, credentials) {
if (err) {
callback(err);
return;
@@ -1131,9 +1131,9 @@ File.prototype.getSignedUrl = function(options, callback) {
options.resource = '/' + this.bucket.name + '/' + name;
- var makeAuthorizedRequest_ = this.bucket.storage.makeAuthorizedRequest_;
+ var makeAuthenticatedRequest_ = this.bucket.storage.makeAuthenticatedRequest_;
- makeAuthorizedRequest_.getCredentials(function(err, credentials) {
+ makeAuthenticatedRequest_.getCredentials(function(err, credentials) {
if (err) {
callback(err);
return;
@@ -1327,7 +1327,7 @@ File.prototype.startResumableUpload_ = function(dup, metadata) {
var self = this;
var uploadStream = resumableUpload({
- authClient: this.bucket.storage.makeAuthorizedRequest_.authClient,
+ authClient: this.bucket.storage.makeAuthenticatedRequest_.authClient,
bucket: this.bucket.name,
file: this.name,
generation: this.generation,
@@ -1375,7 +1375,7 @@ File.prototype.startSimpleUpload_ = function(dup, metadata) {
}
util.makeWritableStream(dup, {
- makeAuthorizedRequest: self.bucket.storage.makeAuthorizedRequest_,
+ makeAuthenticatedRequest: self.bucket.storage.makeAuthenticatedRequest_,
metadata: metadata,
request: reqOpts
}, function(data) {
diff --git a/lib/storage/index.js b/lib/storage/index.js
index b2a71723a0b..c01cf99c62c 100644
--- a/lib/storage/index.js
+++ b/lib/storage/index.js
@@ -93,7 +93,7 @@ function Storage(options) {
throw util.missingProjectIdError;
}
- this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory({
+ this.makeAuthenticatedRequest_ = util.makeAuthenticatedRequestFactory({
credentials: options.credentials,
keyFile: options.keyFilename,
scopes: SCOPES,
@@ -388,7 +388,7 @@ Storage.prototype.makeReq_ = function(method, path, query, body, callback) {
reqOpts.json = body;
}
- this.makeAuthorizedRequest_(reqOpts, callback);
+ this.makeAuthenticatedRequest_(reqOpts, callback);
};
/*! Developer Documentation
diff --git a/test/bigquery/index.js b/test/bigquery/index.js
index f8e62ac010a..ac87d4cd154 100644
--- a/test/bigquery/index.js
+++ b/test/bigquery/index.js
@@ -670,7 +670,7 @@ describe('BigQuery', function() {
var body = { hi: 'there' };
it('should make correct request', function(done) {
- bq.makeAuthorizedRequest_ = function(request) {
+ bq.makeAuthenticatedRequest_ = function(request) {
var basePath = 'https://www.googleapis.com/bigquery/v2/projects/';
assert.equal(request.method, method);
assert.equal(request.uri, basePath + bq.projectId + path);
@@ -682,7 +682,7 @@ describe('BigQuery', function() {
});
it('should execute callback', function(done) {
- bq.makeAuthorizedRequest_ = function(request, callback) {
+ bq.makeAuthenticatedRequest_ = function(request, callback) {
callback();
};
bq.makeReq_(method, path, query, body, done);
diff --git a/test/common/util.js b/test/common/util.js
index 86fa92e1f4f..6de6b948d0a 100644
--- a/test/common/util.js
+++ b/test/common/util.js
@@ -105,8 +105,8 @@ describe('common/util', function() {
it('should export an error for module instantiation errors', function() {
var missingProjectIdError = new Error([
'Sorry, we cannot connect to Google Cloud Services without a project ID.',
- 'See https://googlecloudplatform.github.io/gcloud-node/#/authorization',
- 'for a detailed guide on creating an authorized connection.'
+ 'See https://googlecloudplatform.github.io/gcloud-node/#/authentication',
+ 'for a detailed guide on creating an authenticated connection.'
].join(' '));
assert.deepEqual(util.missingProjectIdError, missingProjectIdError);
@@ -271,7 +271,7 @@ describe('common/util', function() {
util.makeWritableStream(dup, {
metadata: metadata,
- makeAuthorizedRequest: function(request) {
+ makeAuthenticatedRequest: function(request) {
assert.equal(request.method, 'POST');
assert.equal(request.qs.uploadType, 'multipart');
@@ -306,7 +306,7 @@ describe('common/util', function() {
metadata: {
contentType: 'application/json'
},
- makeAuthorizedRequest: function(request) {
+ makeAuthenticatedRequest: function(request) {
assert.equal(request.method, req.method);
assert.deepEqual(request.qs, req.qs);
assert.equal(request.something, req.something);
@@ -331,8 +331,8 @@ describe('common/util', function() {
});
util.makeWritableStream(ws, {
- makeAuthorizedRequest: function(request, opts) {
- opts.onAuthorized(error);
+ makeAuthenticatedRequest: function(request, opts) {
+ opts.onAuthenticated(error);
}
});
});
@@ -345,7 +345,7 @@ describe('common/util', function() {
};
util.makeWritableStream(dup, {
- makeAuthorizedRequest: function() {}
+ makeAuthenticatedRequest: function() {}
});
});
@@ -371,8 +371,8 @@ describe('common/util', function() {
});
util.makeWritableStream(dup, {
- makeAuthorizedRequest: function(request, opts) {
- opts.onAuthorized();
+ makeAuthenticatedRequest: function(request, opts) {
+ opts.onAuthenticated();
}
});
@@ -397,8 +397,8 @@ describe('common/util', function() {
};
var options = {
- makeAuthorizedRequest: function(request, opts) {
- opts.onAuthorized();
+ makeAuthenticatedRequest: function(request, opts) {
+ opts.onAuthenticated();
}
};
@@ -413,7 +413,7 @@ describe('common/util', function() {
});
});
- describe('makeAuthorizedRequestFactory', function() {
+ describe('makeAuthenticatedRequestFactory', function() {
var authClient = { getCredentials: function() {} };
beforeEach(function() {
@@ -431,11 +431,11 @@ describe('common/util', function() {
return authClient;
};
- util.makeAuthorizedRequestFactory(config);
+ util.makeAuthenticatedRequestFactory(config);
});
it('should return a function', function() {
- assert.equal(typeof util.makeAuthorizedRequestFactory(), 'function');
+ assert.equal(typeof util.makeAuthenticatedRequestFactory(), 'function');
});
it('should return a getCredentials method', function(done) {
@@ -447,8 +447,8 @@ describe('common/util', function() {
return { getCredentials: getCredentials };
};
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory();
- makeAuthorizedRequest.getCredentials();
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory();
+ makeAuthenticatedRequest.getCredentials();
});
it('should return the authClient', function() {
@@ -458,15 +458,15 @@ describe('common/util', function() {
return authClient;
};
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory();
- assert.strictEqual(makeAuthorizedRequest.authClient, authClient);
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory();
+ assert.strictEqual(makeAuthenticatedRequest.authClient, authClient);
});
- describe('customEndpoint (no authorization attempted)', function() {
- var makeAuthorizedRequest;
+ describe('customEndpoint (no authentication attempted)', function() {
+ var makeAuthenticatedRequest;
beforeEach(function() {
- makeAuthorizedRequest = util.makeAuthorizedRequestFactory({
+ makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory({
customEndpoint: true
});
});
@@ -479,16 +479,16 @@ describe('common/util', function() {
done();
};
- makeAuthorizedRequest(reqOpts, { onAuthorized: assert.ifError });
+ makeAuthenticatedRequest(reqOpts, { onAuthenticated: assert.ifError });
});
- it('should pass options back to onAuthorized callback', function(done) {
+ it('should pass options back to onAuthenticated callback', function(done) {
var reqOpts = { a: 'b', c: 'd' };
- makeAuthorizedRequest(reqOpts, {
- onAuthorized: function(err, authorizedReqOpts) {
+ makeAuthenticatedRequest(reqOpts, {
+ onAuthenticated: function(err, authenticatedReqOpts) {
assert.ifError(err);
- assert.deepEqual(reqOpts, authorizedReqOpts);
+ assert.deepEqual(reqOpts, authenticatedReqOpts);
done();
}
});
@@ -502,35 +502,35 @@ describe('common/util', function() {
done();
};
- makeAuthorizedRequest(reqOpts, assert.ifError);
+ makeAuthenticatedRequest(reqOpts, assert.ifError);
});
});
- describe('needs authorization', function() {
- it('should pass correct arguments to authorizeRequest', function(done) {
+ describe('needs authentication', function() {
+ it('should pass correct arguments to authenticateRequest', function(done) {
var reqOpts = { e: 'f', g: 'h' };
- authClient.authorizeRequest = function(rOpts) {
+ authClient.authenticateRequest = function(rOpts) {
assert.deepEqual(rOpts, reqOpts);
done();
};
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory();
- makeAuthorizedRequest(reqOpts, {});
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory();
+ makeAuthenticatedRequest(reqOpts, {});
});
it('should return a stream if callback is missing', function() {
- authClient.authorizeRequest = function() {};
+ authClient.authenticateRequest = function() {};
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory({});
- assert(makeAuthorizedRequest({}) instanceof stream.Stream);
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory({});
+ assert(makeAuthenticatedRequest({}) instanceof stream.Stream);
});
- describe('authorization errors', function() {
+ describe('authentication errors', function() {
var error = new Error('Error.');
beforeEach(function() {
- authClient.authorizeRequest = function(rOpts, callback) {
+ authClient.authenticateRequest = function(rOpts, callback) {
setImmediate(function() {
callback(error);
});
@@ -542,15 +542,15 @@ describe('common/util', function() {
utilOverrides.decorateRequest = function() {};
- authClient.authorizeRequest = function(rOpts, callback) {
+ authClient.authenticateRequest = function(rOpts, callback) {
setImmediate(function() {
callback(error);
});
};
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory();
- makeAuthorizedRequest({}, {
- onAuthorized: function(err) {
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory();
+ makeAuthenticatedRequest({}, {
+ onAuthenticated: function(err) {
assert.strictEqual(err, null);
done();
}
@@ -558,17 +558,17 @@ describe('common/util', function() {
});
it('should invoke the callback with error', function(done) {
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory();
- makeAuthorizedRequest({}, function(err) {
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory();
+ makeAuthenticatedRequest({}, function(err) {
assert.strictEqual(err, error);
done();
});
});
- it('should invoke the onAuthorized handler with error', function(done) {
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory();
- makeAuthorizedRequest({}, {
- onAuthorized: function(err) {
+ it('should invoke the onAuthenticated handler with error', function(done) {
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory();
+ makeAuthenticatedRequest({}, {
+ onAuthenticated: function(err) {
assert.strictEqual(err, error);
done();
}
@@ -576,8 +576,8 @@ describe('common/util', function() {
});
it('should emit an error and end the stream', function(done) {
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory();
- makeAuthorizedRequest({}).on('error', function(err) {
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory();
+ makeAuthenticatedRequest({}).on('error', function(err) {
assert.strictEqual(err, error);
var stream = this;
@@ -589,25 +589,25 @@ describe('common/util', function() {
});
});
- describe('authorization success', function() {
+ describe('authentication success', function() {
var reqOpts = { a: 'b', c: 'd' };
beforeEach(function() {
- authClient.authorizeRequest = function(rOpts, callback) {
+ authClient.authenticateRequest = function(rOpts, callback) {
callback(null, rOpts);
};
});
- it('should return the authorized request to callback', function(done) {
+ it('should return the authenticated request to callback', function(done) {
utilOverrides.decorateRequest = function(reqOpts_) {
assert.strictEqual(reqOpts_, reqOpts);
return reqOpts;
};
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory();
- makeAuthorizedRequest(reqOpts, {
- onAuthorized: function(err, authorizedReqOpts) {
- assert.strictEqual(authorizedReqOpts, reqOpts);
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory();
+ makeAuthenticatedRequest(reqOpts, {
+ onAuthenticated: function(err, authenticatedReqOpts) {
+ assert.strictEqual(authenticatedReqOpts, reqOpts);
done();
}
});
@@ -621,28 +621,28 @@ describe('common/util', function() {
return reqOpts;
};
- utilOverrides.makeRequest = function(authorizedReqOpts, cfg, cb) {
- assert.strictEqual(authorizedReqOpts, reqOpts);
+ utilOverrides.makeRequest = function(authenticatedReqOpts, cfg, cb) {
+ assert.strictEqual(authenticatedReqOpts, reqOpts);
assert.deepEqual(cfg, config);
cb();
};
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory(config);
- makeAuthorizedRequest(reqOpts, done);
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory(config);
+ makeAuthenticatedRequest(reqOpts, done);
});
it('should provide stream to makeRequest', function(done) {
var stream;
- utilOverrides.makeRequest = function(authorizedReqOpts, cfg) {
+ utilOverrides.makeRequest = function(authenticatedReqOpts, cfg) {
setImmediate(function() {
assert.strictEqual(cfg.stream, stream);
done();
});
};
- var makeAuthorizedRequest = util.makeAuthorizedRequestFactory({});
- stream = makeAuthorizedRequest(reqOpts);
+ var makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory({});
+ stream = makeAuthenticatedRequest(reqOpts);
});
});
});
diff --git a/test/compute/index.js b/test/compute/index.js
index 31937060d00..5c87b479f98 100644
--- a/test/compute/index.js
+++ b/test/compute/index.js
@@ -25,7 +25,7 @@ var util = require('../../lib/common/util.js');
var slice = Array.prototype.slice;
var fakeUtil = extend({}, util, {
- makeAuthorizedRequestFactory: util.noop
+ makeAuthenticatedRequestFactory: util.noop
});
var extended = false;
@@ -141,20 +141,20 @@ describe('Compute', function() {
});
});
- it('should create a makeAuthorizedRequest method', function(done) {
- fakeUtil.makeAuthorizedRequestFactory = function(options_) {
+ it('should create a makeAuthenticatedRequest method', function(done) {
+ fakeUtil.makeAuthenticatedRequestFactory = function(options_) {
assert.deepEqual(options_, {
credentials: options.credentials,
email: options.email,
keyFile: options.keyFilename,
scopes: ['https://www.googleapis.com/auth/compute']
});
- fakeUtil.makeAuthorizedRequestFactory = util.noop;
+ fakeUtil.makeAuthenticatedRequestFactory = util.noop;
return done;
};
var compute = new Compute(options);
- compute.makeAuthorizedRequest_();
+ compute.makeAuthenticatedRequest_();
});
it('should localize the project id', function() {
@@ -1385,7 +1385,7 @@ describe('Compute', function() {
var query = 'query';
var body = 'body';
- compute.makeAuthorizedRequest_ = function(reqOpts, callback) {
+ compute.makeAuthenticatedRequest_ = function(reqOpts, callback) {
assert.equal(reqOpts.method, method);
assert.equal(reqOpts.qs, query);
diff --git a/test/datastore/request.js b/test/datastore/request.js
index 7c2a4228974..54466c768fa 100644
--- a/test/datastore/request.js
+++ b/test/datastore/request.js
@@ -116,8 +116,8 @@ describe('Request', function() {
requestOverride = null;
request = new Request();
request.apiEndpoint = CUSTOM_ENDPOINT;
- request.makeAuthorizedRequest_ = function(req, callback) {
- (callback.onAuthorized || callback)(null, req);
+ request.makeAuthenticatedRequest_ = function(req, callback) {
+ (callback.onAuthenticated || callback)(null, req);
};
});
@@ -761,7 +761,7 @@ describe('Request', function() {
describe('makeReq_', function() {
beforeEach(function() {
request.connection = {
- createAuthorizedReq: util.noop
+ createAuthenticatedReq: util.noop
};
});
@@ -776,7 +776,7 @@ describe('Request', function() {
});
request.projectId = projectId;
- request.makeAuthorizedRequest_ = function(opts) {
+ request.makeAuthenticatedRequest_ = function(opts) {
assert.equal(opts.method, 'POST');
assert.equal(opts.uri, expectedUri);
assert.equal(opts.headers['Content-Type'], 'application/x-protobuf');
@@ -793,8 +793,8 @@ describe('Request', function() {
done();
return new stream.Writable();
};
- request.makeAuthorizedRequest_ = function(opts, callback) {
- (callback.onAuthorized || callback)(null, mockRequest);
+ request.makeAuthenticatedRequest_ = function(opts, callback) {
+ (callback.onAuthenticated || callback)(null, mockRequest);
};
request.makeReq_('commit', {}, util.noop);
});
@@ -842,8 +842,8 @@ describe('Request', function() {
describe('transactional and non-transactional properties', function() {
beforeEach(function() {
- request.createAuthorizedRequest_ = function(opts, callback) {
- (callback.onAuthorized || callback)();
+ request.createAuthenticatedRequest_ = function(opts, callback) {
+ (callback.onAuthenticated || callback)();
};
});
diff --git a/test/datastore/transaction.js b/test/datastore/transaction.js
index 3d801ffdef5..22d3dc6c644 100644
--- a/test/datastore/transaction.js
+++ b/test/datastore/transaction.js
@@ -73,7 +73,7 @@ describe('Transaction', function() {
beforeEach(function() {
transaction = new Transaction({
- authorizeReq_: function(req, callback) {
+ authenticateReq_: function(req, callback) {
return callback(null, req);
}
}, 'project-id');
@@ -84,7 +84,7 @@ describe('Transaction', function() {
var projectId = 'abc';
var fakeDataset = {
apiEndpoint: 'http://localhost:8080',
- makeAuthorizedRequest_: function fakeMakeAuthorizedRequest_() {}
+ makeAuthenticatedRequest_: function fakeMakeAuthenticatedRequest_() {}
};
var transaction = new Transaction(fakeDataset, projectId);
@@ -92,8 +92,8 @@ describe('Transaction', function() {
assert.strictEqual(transaction.id, null);
assert.deepEqual(transaction.apiEndpoint, fakeDataset.apiEndpoint);
assert.equal(
- transaction.makeAuthorizedRequest_,
- fakeDataset.makeAuthorizedRequest_
+ transaction.makeAuthenticatedRequest_,
+ fakeDataset.makeAuthenticatedRequest_
);
assert.equal(transaction.projectId, projectId);
});
diff --git a/test/dns/index.js b/test/dns/index.js
index f98cea2c001..528235e724b 100644
--- a/test/dns/index.js
+++ b/test/dns/index.js
@@ -37,13 +37,13 @@ var fakeStreamRouter = {
}
};
-var makeAuthorizedRequestFactoryOverride;
+var makeAuthenticatedRequestFactoryOverride;
var fakeUtil = extend({}, util, {
- makeAuthorizedRequestFactory: function() {
- if (makeAuthorizedRequestFactoryOverride) {
- return makeAuthorizedRequestFactoryOverride.apply(null, arguments);
+ makeAuthenticatedRequestFactory: function() {
+ if (makeAuthenticatedRequestFactoryOverride) {
+ return makeAuthenticatedRequestFactoryOverride.apply(null, arguments);
} else {
- return util.makeAuthorizedRequestFactory.apply(null, arguments);
+ return util.makeAuthenticatedRequestFactory.apply(null, arguments);
}
}
});
@@ -76,7 +76,7 @@ describe('DNS', function() {
});
beforeEach(function() {
- makeAuthorizedRequestFactoryOverride = null;
+ makeAuthenticatedRequestFactoryOverride = null;
dns = new DNS({
projectId: PROJECT_ID
@@ -94,7 +94,7 @@ describe('DNS', function() {
}, /Sorry, we cannot connect/);
});
- it('should create an authorized request function', function(done) {
+ it('should create an authenticated request function', function(done) {
var options = {
projectId: 'projectId',
credentials: 'credentials',
@@ -102,7 +102,7 @@ describe('DNS', function() {
keyFilename: 'keyFile'
};
- makeAuthorizedRequestFactoryOverride = function(options_) {
+ makeAuthenticatedRequestFactoryOverride = function(options_) {
assert.deepEqual(options_, {
credentials: options.credentials,
email: options.email,
@@ -116,7 +116,7 @@ describe('DNS', function() {
};
var dns = new DNS(options);
- dns.makeAuthorizedRequest_();
+ dns.makeAuthenticatedRequest_();
});
it('should localize the projectId', function() {
@@ -382,13 +382,13 @@ describe('DNS', function() {
});
describe('makeReq_', function() {
- it('should make correct authorized request', function(done) {
+ it('should make correct authenticated request', function(done) {
var method = 'POST';
var path = '/';
var query = 'query';
var body = 'body';
- dns.makeAuthorizedRequest_ = function(reqOpts, callback) {
+ dns.makeAuthenticatedRequest_ = function(reqOpts, callback) {
assert.equal(reqOpts.method, method);
assert.equal(reqOpts.qs, query);
diff --git a/test/pubsub/index.js b/test/pubsub/index.js
index 14a95d9aea6..5a5f8073c56 100644
--- a/test/pubsub/index.js
+++ b/test/pubsub/index.js
@@ -538,7 +538,7 @@ describe('PubSub', function() {
it('should pass network requests to the connection object', function(done) {
var pubsub = new PubSub({ projectId: PROJECT_ID });
- pubsub.makeAuthorizedRequest_ = function() {
+ pubsub.makeAuthenticatedRequest_ = function() {
done();
};
diff --git a/test/search/index.js b/test/search/index.js
index 644d7604e90..cc0ad67e19e 100644
--- a/test/search/index.js
+++ b/test/search/index.js
@@ -41,13 +41,13 @@ var fakeStreamRouter = {
}
};
-var makeAuthorizedRequestFactoryOverride;
+var makeAuthenticatedRequestFactoryOverride;
var fakeUtil = extend({}, util, {
- makeAuthorizedRequestFactory: function() {
- if (makeAuthorizedRequestFactoryOverride) {
- return makeAuthorizedRequestFactoryOverride.apply(null, arguments);
+ makeAuthenticatedRequestFactory: function() {
+ if (makeAuthenticatedRequestFactoryOverride) {
+ return makeAuthenticatedRequestFactoryOverride.apply(null, arguments);
} else {
- return util.makeAuthorizedRequestFactory.apply(null, arguments);
+ return util.makeAuthenticatedRequestFactory.apply(null, arguments);
}
}
});
@@ -76,7 +76,7 @@ describe('Search', function() {
});
beforeEach(function() {
- makeAuthorizedRequestFactoryOverride = null;
+ makeAuthenticatedRequestFactoryOverride = null;
search = new Search({
projectId: PROJECT_ID
@@ -94,7 +94,7 @@ describe('Search', function() {
}, /Sorry, we cannot connect/);
});
- it('should create an authorized request function', function(done) {
+ it('should create an authenticated request function', function(done) {
var options = {
projectId: 'projectId',
credentials: 'credentials',
@@ -102,7 +102,7 @@ describe('Search', function() {
keyFilename: 'keyFile'
};
- makeAuthorizedRequestFactoryOverride = function(options_) {
+ makeAuthenticatedRequestFactoryOverride = function(options_) {
assert.deepEqual(options_, {
credentials: options.credentials,
email: options.email,
@@ -117,7 +117,7 @@ describe('Search', function() {
};
var search = new Search(options);
- search.makeAuthorizedRequest_();
+ search.makeAuthenticatedRequest_();
});
it('should localize the projectId', function() {
@@ -261,13 +261,13 @@ describe('Search', function() {
});
describe('makeReq_', function() {
- it('should make correct authorized request', function(done) {
+ it('should make correct authenticated request', function(done) {
var method = 'POST';
var path = '/';
var query = 'query';
var body = 'body';
- search.makeAuthorizedRequest_ = function(reqOpts, callback) {
+ search.makeAuthenticatedRequest_ = function(reqOpts, callback) {
assert.equal(reqOpts.method, method);
assert.equal(reqOpts.qs, query);
diff --git a/test/storage/bucket.js b/test/storage/bucket.js
index 8dc1dbe8d1a..f5f44494602 100644
--- a/test/storage/bucket.js
+++ b/test/storage/bucket.js
@@ -85,7 +85,7 @@ describe('Bucket', function() {
var BUCKET_NAME = 'test-bucket';
var bucket;
var options = {
- makeAuthorizedRequest_: function(req, callback) {
+ makeAuthenticatedRequest_: function(req, callback) {
callback(null, req);
}
};
@@ -119,7 +119,7 @@ describe('Bucket', function() {
});
it('should re-use provided connection', function() {
- assert.deepEqual(bucket.authorizeReq_, options.authorizeReq_);
+ assert.deepEqual(bucket.authenticateReq_, options.authenticateReq_);
});
it('should default metadata to an empty object', function() {
@@ -158,7 +158,7 @@ describe('Bucket', function() {
var file1 = bucket.file('1.txt');
var file2 = '2.txt';
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts) {
assert.equal(reqOpts.json.sourceObjects[0].name, file1.name);
assert.equal(reqOpts.json.sourceObjects[1].name, file2);
done();
@@ -174,7 +174,7 @@ describe('Bucket', function() {
];
async.each(destinations, function(destination, next) {
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts) {
assert(reqOpts.uri.indexOf(bucket.name + '/o/destination.txt') > -1);
next();
};
@@ -186,7 +186,7 @@ describe('Bucket', function() {
it('should use content type from the destination metadata', function(done) {
var destination = 'destination.txt';
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts) {
assert.equal(
reqOpts.json.destination.contentType,
mime.contentType(destination)
@@ -201,7 +201,7 @@ describe('Bucket', function() {
var destination = bucket.file('destination.txt');
destination.metadata = { contentType: 'content-type' };
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts) {
assert.equal(
reqOpts.json.destination.contentType,
destination.metadata.contentType
@@ -215,7 +215,7 @@ describe('Bucket', function() {
it('should detect dest content type if not in metadata', function(done) {
var destination = 'destination.txt';
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts) {
assert.equal(
reqOpts.json.destination.contentType,
mime.contentType(destination)
@@ -239,7 +239,7 @@ describe('Bucket', function() {
var sources = [bucket.file('1.txt'), bucket.file('2.txt')];
var destination = bucket.file('destination.txt');
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts) {
var expectedUri = format('{base}/{bucket}/o/{file}/compose', {
base: 'https://www.googleapis.com/storage/v1/b',
bucket: destination.bucket.name,
@@ -261,7 +261,7 @@ describe('Bucket', function() {
var sources = [bucket.file('1.txt'), bucket.file('2.txt')];
var destination = 'needs encoding.jpg';
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts) {
assert.equal(reqOpts.uri.indexOf(destination), -1);
done();
};
@@ -276,7 +276,7 @@ describe('Bucket', function() {
var destination = bucket.file('destination.txt');
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts) {
assert.deepEqual(reqOpts.json.sourceObjects, [
{ name: sources[0].name, generation: sources[0].metadata.generation },
{ name: sources[1].name, generation: sources[1].metadata.generation }
@@ -292,7 +292,7 @@ describe('Bucket', function() {
var sources = [bucket.file('1.txt'), bucket.file('2.txt')];
var destination = 'destination.txt';
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts, callback) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts, callback) {
callback();
};
@@ -305,7 +305,7 @@ describe('Bucket', function() {
var error = new Error('Error.');
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts, callback) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts, callback) {
callback(error);
};
@@ -320,7 +320,7 @@ describe('Bucket', function() {
var destination = 'destination.txt';
var resp = { success: true };
- bucket.storage.makeAuthorizedRequest_ = function(reqOpts, callback) {
+ bucket.storage.makeAuthenticatedRequest_ = function(reqOpts, callback) {
callback(null, resp);
};
@@ -1156,7 +1156,7 @@ describe('Bucket', function() {
var body = { hi: 'there' };
it('should make correct request', function(done) {
- bucket.storage.makeAuthorizedRequest_ = function(request) {
+ bucket.storage.makeAuthenticatedRequest_ = function(request) {
var basePath = 'https://www.googleapis.com/storage/v1/b';
assert.equal(request.method, method);
assert.equal(request.uri, basePath + '/' + bucket.name + path);
@@ -1168,7 +1168,7 @@ describe('Bucket', function() {
});
it('should execute callback', function(done) {
- bucket.storage.makeAuthorizedRequest_ = function(request, callback) {
+ bucket.storage.makeAuthenticatedRequest_ = function(request, callback) {
callback();
};
bucket.makeReq_(method, path, query, body, done);
diff --git a/test/storage/file.js b/test/storage/file.js
index 3886faff4f2..2063ed6f664 100644
--- a/test/storage/file.js
+++ b/test/storage/file.js
@@ -93,9 +93,9 @@ describe('File', function() {
beforeEach(function() {
var options = {
- makeAuthorizedRequest_: function(req, callback) {
+ makeAuthenticatedRequest_: function(req, callback) {
if (callback) {
- (callback.onAuthorized || callback)(null, req);
+ (callback.onAuthenticated || callback)(null, req);
} else {
return (requestOverride || requestCached)(req);
}
@@ -472,7 +472,7 @@ describe('File', function() {
it('should send query.generation if File has one', function(done) {
var versionedFile = new File(bucket, 'file.txt', { generation: 1 });
- versionedFile.bucket.storage.makeAuthorizedRequest_ = function(reqOpts) {
+ versionedFile.bucket.storage.makeAuthenticatedRequest_ = function(reqOpts) {
assert.equal(reqOpts.qs.generation, 1);
setImmediate(function() {
done();
@@ -499,15 +499,15 @@ describe('File', function() {
});
});
- describe('authorizing', function() {
- it('should create an authorized request', function(done) {
+ describe('authenticating', function() {
+ it('should create an authenticated request', function(done) {
var expectedPath = format('https://{host}/{b}/{o}', {
host: 'storage.googleapis.com',
b: file.bucket.name,
o: encodeURIComponent(file.name)
});
- file.bucket.storage.makeAuthorizedRequest_ = function(opts) {
+ file.bucket.storage.makeAuthenticatedRequest_ = function(opts) {
assert.equal(opts.uri, expectedPath);
setImmediate(function() {
done();
@@ -519,7 +519,7 @@ describe('File', function() {
});
it('should accept gzip encoding', function(done) {
- file.bucket.storage.makeAuthorizedRequest_ = function(opts) {
+ file.bucket.storage.makeAuthenticatedRequest_ = function(opts) {
assert.strictEqual(opts.gzip, true);
setImmediate(function() {
done();
@@ -534,7 +534,7 @@ describe('File', function() {
var ERROR = new Error('Error.');
beforeEach(function() {
- file.bucket.storage.makeAuthorizedRequest_ = function(opts) {
+ file.bucket.storage.makeAuthenticatedRequest_ = function(opts) {
var stream = (requestOverride || request)(opts);
setImmediate(function() {
@@ -545,7 +545,7 @@ describe('File', function() {
};
});
- it('should emit an error from authorizing', function(done) {
+ it('should emit an error from authenticating', function(done) {
file.createReadStream()
.once('error', function(err) {
assert.equal(err, ERROR);
@@ -562,7 +562,7 @@ describe('File', function() {
requestOverride = getFakeRequest();
- file.bucket.storage.makeAuthorizedRequest_ = function() {
+ file.bucket.storage.makeAuthenticatedRequest_ = function() {
setImmediate(function() {
assert.deepEqual(requestOverride.getRequestOptions(), fakeRequest);
done();
@@ -587,7 +587,7 @@ describe('File', function() {
it('should unpipe stream from an error on the response', function(done) {
var requestStream = through();
- file.bucket.storage.makeAuthorizedRequest_ = function() {
+ file.bucket.storage.makeAuthenticatedRequest_ = function() {
setImmediate(function() {
// Must be a stream. Doesn't matter for the tests, though.
requestStream.emit('response', through());
@@ -623,7 +623,7 @@ describe('File', function() {
done();
};
- file.bucket.storage.makeAuthorizedRequest_ = function() {
+ file.bucket.storage.makeAuthenticatedRequest_ = function() {
var stream = through();
setImmediate(function() {
stream.emit('complete', response);
@@ -667,9 +667,9 @@ describe('File', function() {
beforeEach(function() {
file.metadata.mediaLink = 'http://uri';
- file.bucket.storage.makeAuthorizedRequest_ = function(opts, callback) {
+ file.bucket.storage.makeAuthenticatedRequest_ = function(opts, callback) {
if (callback) {
- (callback.onAuthorized || callback)(null, {});
+ (callback.onAuthenticated || callback)(null, {});
} else {
return (requestOverride || requestCached)(opts);
}
@@ -1364,7 +1364,7 @@ describe('File', function() {
beforeEach(function() {
var storage = bucket.storage;
- storage.makeAuthorizedRequest_.getCredentials = function(callback) {
+ storage.makeAuthenticatedRequest_.getCredentials = function(callback) {
callback(null, credentials);
};
});
@@ -1581,7 +1581,7 @@ describe('File', function() {
beforeEach(function() {
var storage = bucket.storage;
- storage.makeAuthorizedRequest_.getCredentials = function(callback) {
+ storage.makeAuthenticatedRequest_.getCredentials = function(callback) {
callback(null, credentials);
};
});
@@ -1847,7 +1847,7 @@ describe('File', function() {
resumableUploadOverride = function(opts) {
var bucket = file.bucket;
var storage = bucket.storage;
- var authClient = storage.makeAuthorizedRequest_.authClient;
+ var authClient = storage.makeAuthenticatedRequest_.authClient;
assert.strictEqual(opts.authClient, authClient);
assert.strictEqual(opts.bucket, bucket.name);
From e756c050f093d001b4a8c42408f953fbbf406dd2 Mon Sep 17 00:00:00 2001
From: Danny Hermes
Date: Wed, 2 Sep 2015 12:51:39 -0700
Subject: [PATCH 2/2] Renaming files / paths that use authorization.
Instead swapping out for authentication.
---
docs/{authorization.md => authentication.md} | 0
.../authorization.html => authentication/authentication.html} | 0
.../authorization.js => authentication/authentication.js} | 0
3 files changed, 0 insertions(+), 0 deletions(-)
rename docs/{authorization.md => authentication.md} (100%)
rename docs/site/components/{authorization/authorization.html => authentication/authentication.html} (100%)
rename docs/site/components/{authorization/authorization.js => authentication/authentication.js} (100%)
diff --git a/docs/authorization.md b/docs/authentication.md
similarity index 100%
rename from docs/authorization.md
rename to docs/authentication.md
diff --git a/docs/site/components/authorization/authorization.html b/docs/site/components/authentication/authentication.html
similarity index 100%
rename from docs/site/components/authorization/authorization.html
rename to docs/site/components/authentication/authentication.html
diff --git a/docs/site/components/authorization/authorization.js b/docs/site/components/authentication/authentication.js
similarity index 100%
rename from docs/site/components/authorization/authorization.js
rename to docs/site/components/authentication/authentication.js