diff --git a/src/authentication/index.js b/src/authentication/index.js index e38a401d..c1003ac2 100644 --- a/src/authentication/index.js +++ b/src/authentication/index.js @@ -214,6 +214,7 @@ Authentication.prototype.getSSOData = function (withActiveDirectories, cb) { return this.request .get(url) + .withCredentials() .end(responseHandler(cb)); }; diff --git a/src/helper/request-builder.js b/src/helper/request-builder.js index 61662354..e74e0d37 100644 --- a/src/helper/request-builder.js +++ b/src/helper/request-builder.js @@ -49,6 +49,11 @@ RequestObj.prototype.send = function (body) { return this; }; +RequestObj.prototype.withCredentials = function () { + this.request = this.request.withCredentials(); + return this; +}; + RequestObj.prototype.end = function (cb) { this.request = this.request.end(cb); return new RequestWrapper(this.request); diff --git a/test/helper/request-builder.test.js b/test/helper/request-builder.test.js index 85dafdf1..b9cc558d 100644 --- a/test/helper/request-builder.test.js +++ b/test/helper/request-builder.test.js @@ -84,6 +84,7 @@ describe('helpers requestBuilder', function () { var req = new RequestBuilder({}) var handler = req .get('https://test.com') + .withCredentials() .end(function(err, data) { }); diff --git a/test/mock/request-mock.js b/test/mock/request-mock.js index 7b3d0cd0..7b61cf62 100644 --- a/test/mock/request-mock.js +++ b/test/mock/request-mock.js @@ -24,6 +24,10 @@ RequestMock.prototype.set = function (key, value) { RequestMock.prototype.abort = function () { }; +RequestMock.prototype.withCredentials = function () { + return this; +}; + RequestMock.prototype.end = function (cb) { expect(this.options.headers).to.eql({}); this.options.cb(cb);