Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed xtend #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions lib/passport-wsfed-saml2/samlp.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var xpath = require('xpath');
var qs = require('querystring');
var zlib = require('zlib');
var xtend = require('xtend');
var url = require('url');
var xmlenc = require('xml-encryption');
var crypto = require('crypto');
Expand Down Expand Up @@ -108,7 +107,7 @@ var algorithms = {

Samlp.prototype = {
getSamlRequestParams: function (opts, callback) {
var options = xtend(opts || {}, this.options);
var options = Object.assign({}, opts || {}, this.options);

var idpUrl = options.identityProviderUrl;
if (typeof idpUrl !== 'string' || !validUrl.isWebUri(idpUrl)) {
Expand All @@ -135,7 +134,7 @@ Samlp.prototype = {
};

if (options.requestContext) {
model = xtend(model, options.requestContext);
model = Object.assign({}, model, options.requestContext);
}

var SAMLRequest;
Expand Down Expand Up @@ -218,19 +217,19 @@ Samlp.prototype = {
},

getSamlRequestUrl: function (opts, callback) {
var options = xtend(opts || {}, this.options);
var options = Object.assign({}, opts || {}, this.options);

this.getSamlRequestParams(options, function (err, params) {
if (err) return callback(err);

var parsedUrl = url.parse(options.identityProviderUrl, true);
var samlRequestUrl = options.identityProviderUrl.split('?')[0] + '?' + qs.encode(xtend(parsedUrl.query, params));
var samlRequestUrl = options.identityProviderUrl.split('?')[0] + '?' + qs.encode(Object.assign({}, parsedUrl.query, params));
return callback(null, samlRequestUrl);
});
},

getSamlRequestForm: function (opts, callback) {
var options = xtend(opts || {}, this.options);
var options = Object.assign({}, opts || {}, this.options);

this.getSamlRequestParams(options, function (err, params) {
if (err) return callback(err);
Expand Down
3 changes: 1 addition & 2 deletions lib/passport-wsfed-saml2/wsfederation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var xtend = require('xtend');
var qs = require('querystring');
var xpath = require('xpath');

Expand All @@ -14,7 +13,7 @@ var WsFederation = module.exports = function WsFederation (realm, homerealm, ide

WsFederation.prototype = {
getRequestSecurityTokenUrl: function (options) {
var query = xtend(options || {}, {
var query = Object.assign({}, options || {}, {
wtrealm: this.realm,
wa: 'wsignin1.0'
});
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"xml-encryption": "0.11.0",
"xml2js": "0.1.x",
"xmldom": "auth0/xmldom#v0.1.19-auth0_1",
"xpath": "0.0.5",
"xtend": "~2.0.3"
"xpath": "0.0.5"
},
"devDependencies": {
"chai": "2.x.x",
Expand Down
3 changes: 1 addition & 2 deletions test/fixture/samlp-server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var express = require('express');
var http = require('http');
var samlp = require('samlp');
var xtend = require('xtend');
var fs = require('fs');
var path = require('path');

Expand Down Expand Up @@ -311,7 +310,7 @@ module.exports.start = function(options, callback){

//configure samlp middleware
app.get('/samlp', function(req, res, next) {
samlp.auth(xtend({}, {
samlp.auth(Object.assign({
issuer: 'urn:fixture-test',
getPostURL: getPostURL,
cert: credentials.cert,
Expand Down
3 changes: 1 addition & 2 deletions test/fixture/wsfed-server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var express = require('express');
var http = require('http');
var wsfed = require('wsfed');
var xtend = require('xtend');
var fs = require('fs');
var path = require('path');

Expand Down Expand Up @@ -74,7 +73,7 @@ module.exports.start = function(options, callback){
}

app.get('/login',
wsfed.auth(xtend({}, {
wsfed.auth(Object.assign({
issuer: 'fixture-test',
getPostURL: getPostURL,
cert: credentials.cert,
Expand Down