How to use the ms-rest.requestPipeline function in ms-rest

To help you get started, we’ve selected a few ms-rest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-node / test / services / batchManagement / batchManagementClient-tests.js View on Github external
//
// See the License for the specific language governing permissions and
// limitations under the License.
//


var should = require('should');
var util = require('util');
var fs = require('fs');
var msRest = require('ms-rest');
var msRestAzure = require('ms-rest-azure');
var SuiteBase = require('../../framework/suite-base');
var FileTokenCache = require('../../../lib/util/fileTokenCache');
var BatchManagementClient = require('../../../lib/services/batchManagement/lib/batchManagementClient');
var WebResource = msRest.WebResource;
var Pipeline = msRest.requestPipeline;
var ServiceClient = msRest.ServiceClient;
var testPrefix = 'batchmanagementservice-tests';
var groupPrefix = 'nodeTestGroup';
var accountPrefix = 'testacc';
var createdGroups = [];
var createdAccounts = [];

var requiredEnvironment = [
  { name: 'AZURE_TEST_LOCATION', defaultValue: 'japaneast' },
  { name: 'AZURE_AUTOSTORAGE', defaultValue: 'nodesdkteststorage' }
];

var suite;
var client;
var groupName;
var location;
github Azure / azure-sdk-for-node / runtime / ms-rest-azure / lib / credentials / keyVaultCredentials.js View on Github external

'use strict';
/* jshint latedef:false */

const url = require('url');
const msRest = require('ms-rest');
const ApplicationTokenCredentials = require('./applicationTokenCredentials');
const UserTokenCredentials = require('./userTokenCredentials');
const DeviceTokenCredentials = require('./deviceTokenCredentials');
const MSITokenCredentials = require('./msiTokenCredentials');
const MSIVmTokenCredentials = require('./msiVmTokenCredentials');
const MSIAppServiceTokenCredentials = require('./msiAppServiceTokenCredentials');

const AuthenticationContext = require('adal-node').AuthenticationContext;
let HeaderConstants = msRest.Constants.HeaderConstants;
let requestPipeline = msRest.requestPipeline;


function authenticatorMapper(credentials) {
  return function (challenge, callback) {
    // Function to take token Response and format a authorization value
    function _formAuthorizationValue(err, tokenResponse) {
      if (err) {
        return callback(err);
      }
      // Calculate the value to be set in the request's Authorization header and resume the call.
      var authorizationValue = tokenResponse.tokenType + ' ' + tokenResponse.accessToken;

      return callback(null, authorizationValue);
    }

    // Create a new authentication context.
github Azure / azure-sdk-for-node / lib / services / keyVault / lib / keyVaultCredentials.js View on Github external
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

'use strict';
/* jshint latedef:false */

var Url = require('url');
var msRest = require('ms-rest');
var HeaderConstants = msRest.Constants.HeaderConstants;
var requestPipeline = msRest.requestPipeline;

/**
 * An object that performs authentication for Key Vault.
 * @class
 * @param {KeyVaultCredentials~authRequest} authenticator  A callback that receives a challenge and returns an authentication token.
 */
function KeyVaultCredentials(authenticator) {
    this.challengeCache = [];
    this.authenticator = authenticator;
}

KeyVaultCredentials.prototype.signRequest = function (resource, callback) {
  // authentication is provided by the createSigningFilter method.
  callback(null);
};
github Azure / azure-sdk-for-node / test / services / batch / batchClient-tests.js View on Github external
var should = require('should');
var util = require('util');
var fs = require('fs');
var stream = require('stream');
var moment = require('moment');
var uuid = require('uuid');
var msRest = require('ms-rest');
var msRestAzure = require('ms-rest-azure');
var adal = require('adal-node');
var SuiteBase = require('../../framework/suite-base');
var FileTokenCache = require('../../../lib/util/fileTokenCache');
var BatchServiceClient = require('../../../lib/services/batch/lib/batchServiceClient');
var BatchCredentials = require('../../../lib/services/batch/lib/batchSharedKeyCredentials')
var WebResource = msRest.WebResource;
var Pipeline = msRest.requestPipeline;
var ServiceClient = msRest.ServiceClient;
var testPrefix = 'batchservice-tests';
var groupPrefix = 'nodeTestGroup';
var accountPrefix = 'testacc';
var certThumb = 'cff2ab63c8c955aaf71989efa641b906558d9fb7';
var nonAdminPoolUser = 'nonAdminUser';
var createdGroups = [];
var createdAccounts = [];

var requiredEnvironment = [
  { name: 'AZURE_BATCH_ACCOUNT', defaultValue: 'batchtestnodesdk' },
  { name: 'AZURE_BATCH_ENDPOINT', defaultValue: 'https://batchtestnodesdk.japaneast.batch.azure.com/'}
];

var suite;
var client;