UNPKG

dhl-express-api-client

Version:
31 lines 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.configureAuthMethods = exports.BasicAuthAuthentication = void 0; var BasicAuthAuthentication = (function () { function BasicAuthAuthentication(username, password) { this.username = username; this.password = password; } BasicAuthAuthentication.prototype.getName = function () { return "basicAuth"; }; BasicAuthAuthentication.prototype.applySecurityAuthentication = function (context) { var comb = this.username + ":" + this.password; context.setHeaderParam("Authorization", "Basic " + btoa(comb)); }; return BasicAuthAuthentication; }()); exports.BasicAuthAuthentication = BasicAuthAuthentication; function configureAuthMethods(config) { var authMethods = {}; if (!config) { return authMethods; } authMethods["default"] = config["default"]; if (config["basicAuth"]) { authMethods["basicAuth"] = new BasicAuthAuthentication(config["basicAuth"]["username"], config["basicAuth"]["password"]); } return authMethods; } exports.configureAuthMethods = configureAuthMethods; //# sourceMappingURL=auth.js.map