1 /**
  2  * @fileOverview Google Storage for Developers Authentication.
  3  */
  4 
  5 /** @ignore */
  6 (function () {
  7   // Requires.
  8   var http = require('http'),
  9     crypto = require('crypto'),
 10     parse = require('url').parse,
 11     util = require('util'),
 12     utils = require("../../utils"),
 13     AwsAuthentication = require("../aws").Authentication,
 14     GoogleAuthentication;
 15 
 16   /**
 17    * Google Authentication class.
 18    *
 19    * Google implements the AWS S3 API, so we just reuse everything.
 20    *
 21    * @param  {Object}   options     Options object.
 22    * @config {string}   account     Account name.
 23    * @config {string}   secretKey   Secret key.
 24    * @config {string}   [ssl=false] Use SSL?
 25    * @config {string}   [authUrl]   Authentication URL.
 26    * @config {number}   [timeout]   HTTP timeout in seconds.
 27    * @extends provider.aws.Authentication
 28    * @exports GoogleAuthentication as provider.google.Authentication
 29    * @constructor
 30    */
 31   GoogleAuthentication = function (options) {
 32     // Patch GSFD-specific options.
 33     options = utils.extend(options);
 34     options.authUrl = options.authUrl || "commondatastorage.googleapis.com";
 35 
 36     // Call superclass.
 37     AwsAuthentication.call(this, options);
 38 
 39     this._CUSTOM_HEADER_PREFIX = "x-goog";
 40     this._CUSTOM_HEADER_RE = /^x-goog-/i;
 41     this._SIGNATURE_ID = "GOOG1";
 42     this._CONN_CLS = require("./connection").Connection;
 43   };
 44 
 45   util.inherits(GoogleAuthentication, AwsAuthentication);
 46 
 47   /** Test provider (Google Storage). */
 48   GoogleAuthentication.prototype.isGoogle = function () {
 49     return true;
 50   };
 51 
 52   module.exports.Authentication = GoogleAuthentication;
 53 }());
 54