diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..25e99fc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +name: Run Test + +on: + push: + pull_request: + +jobs: + mocha-test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [10.x, 12.x, 14.x] + steps: + - name: Use Node Version ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Install Dependencies + run: yarn + + - name: Run Test + run: yarn test + env: + CI: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index ad312f6..1b53f6c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules .DS_Store .vscode package-lock.json +yarn.lock *.log diff --git a/.travis.yml b/.travis.yml index 5911b74..7af1053 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: - - 6 - - 8 - 10 + - 12 + - 14 diff --git a/SECURITY-NOTICE.md b/SECURITY-NOTICE.md index 39cd237..1cb6103 100644 --- a/SECURITY-NOTICE.md +++ b/SECURITY-NOTICE.md @@ -6,7 +6,7 @@ maintaining the signature valid. This could allow an authenticated attacker to " Updated packages are available on npm. To ensure delivery of additional bug fixes moving forward, please make sure your `package.json` file is updated to take patch and minor level updates of our libraries. See below: -``` +```json { "dependencies": { "passport-wsfed-saml2": "^3.0.10" @@ -20,9 +20,8 @@ This fix patches the library that your application runs, but will not impact you You can read more details regarding the vulnerability [here](https://auth0.com/docs/security/bulletins/cve-2018-8085). - - Security vulnerability details for passport-wsfed-saml2 < 3.0.5 + =============================================================== A vulnerability has been discovered in the passport-wsfed-saml2 library affecting versions < 3.0.5. This vulnerability allows an attacker to impersonate another user and potentially elevate their privileges if the SAML identity provider: @@ -34,7 +33,7 @@ Developers using the passport-wsfed-saml2 Passport Strategy need to upgrade to t Updated packages are available on npm. To ensure delivery of additional bug fixes moving forward, please make sure your `package.json` file is updated to take patch and minor level updates of our libraries. See below: -``` +```json { "dependencies": { "passport-wsfed-saml2": "^3.0.5" diff --git a/examples/auth0/app.js b/examples/auth0/app.js index 418e732..7eb5b9f 100644 --- a/examples/auth0/app.js +++ b/examples/auth0/app.js @@ -33,19 +33,17 @@ passport.use(new Strategy( var app = express(); // configure Express -app.configure(function() { - app.set('views', __dirname + '/views'); - app.set('view engine', 'ejs'); - app.use(express.logger()); - app.use(express.cookieParser()); - app.use(express.bodyParser()); - app.use(express.methodOverride()); - app.use(express.session({ secret: 'keyboard cat' })); - app.use(passport.initialize()); - app.use(passport.session()); - app.use(app.router); - app.use(express.static(__dirname + '/../../public')); -}); +app.set('views', __dirname + '/views'); +app.set('view engine', 'ejs'); +app.use(express.logger()); +app.use(express.cookieParser()); +app.use(express.bodyParser()); +app.use(express.methodOverride()); +app.use(express.session({ secret: 'keyboard cat' })); +app.use(passport.initialize()); +app.use(passport.session()); +app.use(app.router); +app.use(express.static(__dirname + '/../../public')); app.get('/', function(req, res){ diff --git a/lib/passport-wsfed-saml2/saml.js b/lib/passport-wsfed-saml2/saml.js index b05a534..80040ee 100644 --- a/lib/passport-wsfed-saml2/saml.js +++ b/lib/passport-wsfed-saml2/saml.js @@ -4,7 +4,7 @@ var crypto = require('crypto'); var xpath = require('xpath'); var xmlCrypto = require('xml-crypto'); var EventEmitter = require('events'); -const x509 = require('x509'); +const forge = require('node-forge'); const utils = require('./utils'); var ELEMENT_NODE = 1; @@ -64,7 +64,7 @@ SAML.prototype.validateSignature = function (xml, options, callback) { if (embeddedSignature.length > 0) { var base64cer = embeddedSignature[0].firstChild.toString(); var shasum = crypto.createHash('sha1'); - var der = new Buffer(base64cer, 'base64').toString('binary'); + var der = new Buffer.from(base64cer, 'base64').toString('binary'); shasum.update(der, 'latin1'); self.calculatedThumbprint = shasum.digest('hex'); @@ -134,12 +134,12 @@ SAML.prototype.extractAndValidateCertExpiration = function (validatedSamlAsserti if (!cert) { return false; } - const parsedCert = x509.parseCert(utils.certToPEM(cert)); + const parsedCert = forge.pki.certificateFromPem(utils.certToPEM(cert)); const nowDate = new Date(); // true if current date is before expiry AND after cert start date - if ( ! (nowDate > parsedCert.notBefore && nowDate < parsedCert.notAfter)) { + if ( ! (nowDate > parsedCert.validity.notBefore && nowDate < parsedCert.validity.notAfter)) { this.eventEmitter.emit('certificateExpirationValidationFailed', {}); return false; } diff --git a/lib/passport-wsfed-saml2/samlp.js b/lib/passport-wsfed-saml2/samlp.js index a46aa09..e48e8c7 100644 --- a/lib/passport-wsfed-saml2/samlp.js +++ b/lib/passport-wsfed-saml2/samlp.js @@ -204,12 +204,12 @@ Samlp.prototype = { SAMLRequest = trimXml(sig.getSignedXml()); } - params.SAMLRequest = new Buffer(SAMLRequest).toString('base64'); + params.SAMLRequest = new Buffer.from(SAMLRequest).toString('base64'); return callback(null, params); } // HTTP-Redirect with deflate encoding (http://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf - section 3.4.4.1) - zlib.deflateRaw(new Buffer(SAMLRequest), function (err, buffer) { + zlib.deflateRaw(new Buffer.from(SAMLRequest), function (err, buffer) { if (err) return callback(err); params.SAMLRequest = buffer.toString('base64'); @@ -263,12 +263,12 @@ Samlp.prototype = { }, decodeResponse: function(req) { - var decoded = new Buffer(req.body['SAMLResponse'], 'base64').toString(this.default_encoding); + var decoded = new Buffer.from(req.body['SAMLResponse'], 'base64').toString(this.default_encoding); const encoding = utils.getEncoding(decoded); if (encoding && encodingMappings[encoding] && encodingMappings[encoding] !== this.default_encoding){ // Encoding defers from the one configured, decode again with the correct value - decoded = new Buffer(req.body['SAMLResponse'], 'base64').toString(encodingMappings[encoding]); + decoded = new Buffer.from(req.body['SAMLResponse'], 'base64').toString(encodingMappings[encoding]); } return decoded; diff --git a/package.json b/package.json index f12c35e..3a091ee 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "passport-wsfed-saml2", - "version": "4.1.0", + "version": "4.1.1", "description": "SAML2 Protocol and WS-Fed library", "scripts": { - "test": "mocha --reporter spec --recursive" + "test": "mocha --reporter spec --recursive --exit" }, "author": { "name": "Matias Woloski", @@ -19,34 +19,35 @@ }, "main": "./lib/passport-wsfed-saml2", "dependencies": { - "ejs": "2.5.5", - "jsonwebtoken": "~5.0.4", + "ejs": "3.1.5", + "jsonwebtoken": "~8.5.1", + "node-forge": "^0.10.0", "passport-strategy": "^1.0.0", "uid2": "0.0.x", "valid-url": "^1.0.9", - "x509": "^0.3.4", - "xml-crypto": "auth0/xml-crypto#v1.4.1-auth0.2", - "xml-encryption": "auth0/node-xml-encryption#v0.12.0", - "xml2js": "0.1.x", + "xml-crypto": "2.0.0", + "xml-encryption": "1.2.1", + "xml2js": "0.4.23", "xmldom": "auth0/xmldom#v0.1.19-auth0.2", - "xpath": "0.0.5", - "xtend": "~2.0.3" + "xpath": "0.0.32", + "xtend": "~4.0.2" }, "devDependencies": { - "chai": "2.x.x", + "body-parser": "^1.19.0", + "chai": "4.x.x", "chai-passport-strategy": "1.x.x", - "cheerio": "~0.19.0", - "express": "~3.11.0", - "mocha": "~1.8.1", - "passport": "^0.3.2", + "cheerio": "~1.0.0-rc.5", + "express": "~4.17.1", + "mocha": "~8.2.0", + "passport": "^0.4.1", "request": "~2.88.0", - "saml": "~0.4.4", - "samlp": "~0.4.3", - "should": "~1.1.0", - "wsfed": "~0.3.5" + "saml": "~1.0.0", + "samlp": "~3.4.2", + "should": "~13.2.3", + "wsfed": "~6.0.0" }, "engines": { - "node": ">= 4" + "node": ">= 10" }, "licenses": [ { diff --git a/test/fixture/samlp-server.js b/test/fixture/samlp-server.js index c8fc337..0446f90 100644 --- a/test/fixture/samlp-server.js +++ b/test/fixture/samlp-server.js @@ -1,3 +1,4 @@ +var bodyParser = require('body-parser'); var express = require('express'); var http = require('http'); var samlp = require('samlp'); @@ -295,14 +296,12 @@ module.exports.start = function(options, callback){ var app = express(); - app.configure(function(){ - this.use(express.bodyParser()); - this.use(passport.initialize()); - this.use(passport.session()); - this.use(function(req,res,next){ - req.user = fakeUser; - next(); - }); + app.use(bodyParser.urlencoded({ extended: false })); + app.use(passport.initialize()); + app.use(passport.session()); + app.use(function(req,res,next){ + req.user = fakeUser; + next(); }); function getPostURL (audience, samlRequestDom, req, callback) { @@ -407,7 +406,7 @@ module.exports.start = function(options, callback){ app.post('/callback/samlp-with-invalid-xml', function (req, res, next) { passport.authenticate('samlp-with-utf8', { protocol: 'samlp' }, function(err, user, info) { - res.send(400, { message: err.message }); + res.status(400).json({ message: err.message }); })(req, res, next); }, function(req, res) { diff --git a/test/fixture/wsfed-server.js b/test/fixture/wsfed-server.js index 2a068ef..f2902b9 100644 --- a/test/fixture/wsfed-server.js +++ b/test/fixture/wsfed-server.js @@ -1,3 +1,4 @@ +var bodyParser = require('body-parser'); var express = require('express'); var http = require('http'); var wsfed = require('wsfed'); @@ -59,14 +60,12 @@ module.exports.start = function(options, callback){ var app = express(); - app.configure(function(){ - this.use(express.bodyParser()); - this.use(passport.initialize()); - this.use(passport.session()); - this.use(function(req,res,next){ - req.user = fakeUser; - next(); - }); + app.use(bodyParser.urlencoded({ extended: false })); + app.use(passport.initialize()); + app.use(passport.session()); + app.use(function(req,res,next){ + req.user = fakeUser; + next(); }); function getPostURL (wtrealm, wreply, req, callback) { @@ -84,7 +83,7 @@ module.exports.start = function(options, callback){ app.post('/callback/wresult-with-invalid-xml', function (req, res, next) { passport.authenticate('wsfed-saml2', function(err, user, info) { - res.send(400, { message: err.message }); + res.status(400).json({ message: err.message }); })(req, res, next); }, function(req, res) { @@ -99,7 +98,10 @@ module.exports.start = function(options, callback){ }); var server = http.createServer(app).listen(5050, callback); - module.exports.close = server.close.bind(server); + module.exports.close = function(callback) { + server.close.bind(server); + callback(); + } }; module.exports.fakeUser = fakeUser; diff --git a/test/interop.tests.js b/test/interop.tests.js index a7e0887..5408555 100644 --- a/test/interop.tests.js +++ b/test/interop.tests.js @@ -265,7 +265,7 @@ describe('interop', function () { var sm = new SamlPassport(samlOptions); var sp = new samlp(samlpOptions, sm); - sp.validateSamlResponse(new Buffer(response, 'base64').toString(), + sp.validateSamlResponse(new Buffer.from(response, 'base64').toString(), function(err, profile){ if (err) return done(err); assert.ok(profile); @@ -291,7 +291,7 @@ describe('interop', function () { var sm = new SamlPassport(samlOptions); var sp = new samlp(samlpOptions, sm); - sp.validateSamlResponse(new Buffer(response, 'base64').toString(), + sp.validateSamlResponse(new Buffer.from(response, 'base64').toString(), function(err, profile){ if (err) { assert.ok(err); @@ -304,7 +304,7 @@ describe('interop', function () { it('should validate an assertion from RSA IDM with no embedded signature and supplying a cert', function (done) { var response = 'PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIENvbnNlbnQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpjb25zZW50OnVuc3BlY2lmaWVkIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9uZXRmb3JteC5hdXRoMC5jb20vbG9naW4vY2FsbGJhY2s/Y29ubmVjdGlvbj1lbWMtdGVzdCIgSUQ9ImVkNmIxZDg4NDk0OTJjOTZiN2U1MmU0OGI1N2YxZGU0IiBJblJlc3BvbnNlVG89Il82ODhjNzJjYzBlMWE1ZGZjN2M3NiIgSXNzdWVJbnN0YW50PSIyMDE1LTA1LTI3VDExOjM1OjQxWiIgVmVyc2lvbj0iMi4wIj48c2FtbDpJc3N1ZXI+aHR0cDovL2VtYy5jb20vaWRwL05ldGZvcm14PC9zYW1sOklzc3Vlcj48ZH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WlGRjRvc2N0NmxVSFM5THZNZG1jeFl5cVg3UEhkUnh1ZHJFCkZDNWhCT2tZclNidVNKNUpGTEdPM0E9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=='; - var cert = pemToCert(new Buffer(encoded_cert, 'base64').toString()); + var cert = pemToCert(new Buffer.from(encoded_cert, 'base64').toString()); var samlOptions = { cert: cert, thumbprints: ['bc58b95946e0c96b464b561b02d740aeae88875a'], @@ -321,7 +321,7 @@ describe('interop', function () { var sm = new SamlPassport(samlOptions); var sp = new samlp(samlpOptions, sm); - sp.validateSamlResponse(new Buffer(response, 'base64').toString(), + sp.validateSamlResponse(new Buffer.from(response, 'base64').toString(), function(err, profile){ if (err) return done(err); assert.ok(profile); @@ -358,7 +358,7 @@ describe('interop', function () { var sm = new SamlPassport(samlOptions); var sp = new samlp(samlpOptions, sm); - sp.validateSamlResponse(new Buffer(response, 'base64').toString(), function (err){ + sp.validateSamlResponse(new Buffer.from(response, 'base64').toString(), function (err){ assert.ok(err); expect(err.toString()).to.equal('Error: Invalid thumbprint (configured: ANOTHER_THUMB. calculated: CD78CA598A6FB28A4D70EF6846C1141666A24240)'); done(); diff --git a/test/saml20.tests.js b/test/saml20.tests.js index aecb6ec..be687f8 100644 --- a/test/saml20.tests.js +++ b/test/saml20.tests.js @@ -1,6 +1,7 @@ var assert = require('assert'), fs = require('fs'), helpers = require('./helpers'), + expect = require('chai').expect, should = require('should'), saml20 = require('saml').Saml20, utils = require('../lib/passport-wsfed-saml2/utils'), @@ -112,11 +113,11 @@ describe('saml 2.0 assertion', function () { const samlPassport = new SamlPassport({cert: publicKey, realm: 'urn:myapp', checkRecipient: false}); var profile = samlPassport.validateSamlAssertion(signedAssertion, function(err, profile) { if (err) return done(err); - +console.log({profile}); assert.ok(profile); profile['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/groups'].should.be.an.instanceOf(Array); - profile['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/groups'].should.include('Admins'); - profile['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/groups'].should.include('Contributors'); + expect(profile['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/groups']).to.include('Admins'); + expect(profile['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/groups']).to.include('Contributors'); done(); }); diff --git a/test/samlp.functional.tests.js b/test/samlp.functional.tests.js index 7e32357..eccb843 100644 --- a/test/samlp.functional.tests.js +++ b/test/samlp.functional.tests.js @@ -211,7 +211,7 @@ describe('samlp (functional tests)', function () { before(function (done) { const samlxml = fs.readFileSync(path.join(__dirname, './samples/plain/samlresponse_explicit_iso.txt')).toString(); - const samlEncoded = new Buffer(samlxml, 'binary').toString('base64'); + const samlEncoded = new Buffer.from(samlxml, 'binary').toString('base64'); request.post({ jar: request.jar(), @@ -244,7 +244,7 @@ describe('samlp (functional tests)', function () { before(function (done) { const samlxml = fs.readFileSync(path.join(__dirname, './samples/plain/samlresponse_iso.txt')).toString(); - const samlEncoded = new Buffer(samlxml, 'binary').toString('base64'); + const samlEncoded = new Buffer.from(samlxml, 'binary').toString('base64'); request.post({ jar: request.jar(), @@ -346,7 +346,7 @@ describe('samlp (functional tests)', function () { expect(querystring).to.have.property('SAMLRequest'); var SAMLRequest = querystring.SAMLRequest; - zlib.inflateRaw(new Buffer(SAMLRequest, 'base64'), function (err, buffer) { + zlib.inflateRaw(new Buffer.from(SAMLRequest, 'base64'), function (err, buffer) { if (err) return done(err); var request = buffer.toString(); var doc = new xmldom.DOMParser().parseFromString(request); @@ -401,7 +401,7 @@ describe('samlp (functional tests)', function () { var SAMLRequest = $('form input[name="SAMLRequest"]').val(); expect(SAMLRequest).to.be.ok; - var doc = new xmldom.DOMParser().parseFromString(new Buffer(SAMLRequest, 'base64').toString()); + var doc = new xmldom.DOMParser().parseFromString(new Buffer.from(SAMLRequest, 'base64').toString()); expect(doc.documentElement.getAttribute('ProtocolBinding')) .to.equal('urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'); @@ -451,7 +451,7 @@ describe('samlp (functional tests)', function () { expect(querystring).to.have.property('SAMLRequest'); var SAMLRequest = querystring.SAMLRequest; - zlib.inflateRaw(new Buffer(SAMLRequest, 'base64'), function (err, buffer) { + zlib.inflateRaw(new Buffer.from(SAMLRequest, 'base64'), function (err, buffer) { if (err) return done(err); var request = buffer.toString(); var doc = new xmldom.DOMParser().parseFromString(request); @@ -530,7 +530,7 @@ describe('samlp (functional tests)', function () { it('should have signed SAMLRequest with valid signature', function(done){ var signedSAMLRequest = $('form input[name="SAMLRequest"]').val(); - var signedRequest = new Buffer(signedSAMLRequest, 'base64').toString(); + var signedRequest = new Buffer.from(signedSAMLRequest, 'base64').toString(); var signingCert = fs.readFileSync(__dirname + '/test-auth0.pem'); expect(helpers.isValidSignature(signedRequest, signingCert)) @@ -541,7 +541,7 @@ describe('samlp (functional tests)', function () { it('should show issuer before signature', function(done){ var signedSAMLRequest = $('form input[name="SAMLRequest"]').val(); - var signedRequest = new Buffer(signedSAMLRequest, 'base64').toString(); + var signedRequest = new Buffer.from(signedSAMLRequest, 'base64').toString(); var doc = new xmldom.DOMParser().parseFromString(signedRequest); // First child has to be the issuer @@ -581,7 +581,7 @@ describe('samlp (functional tests)', function () { expect(querystring.RelayState).to.equal('somestate'); var signedSAMLRequest = querystring.SAMLRequest; - var signedRequest = new Buffer(signedSAMLRequest, 'base64').toString(); + var signedRequest = new Buffer.from(signedSAMLRequest, 'base64').toString(); var signingCert = fs.readFileSync(__dirname + '/test-auth0.pem'); expect(helpers.isValidSignature(signedRequest, signingCert)) diff --git a/test/samlp.tests.js b/test/samlp.tests.js index b44bc84..8a02eea 100644 --- a/test/samlp.tests.js +++ b/test/samlp.tests.js @@ -298,7 +298,7 @@ describe('samlp (unit tests)', function () { it('should return profile even if the namespace is in response element', function(done){ var cert = fs.readFileSync(__dirname + '/test-auth0.cer'); var encodedSamlResponse = 'PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzYW1scDpSZXNwb25zZSB4bWxuczpzYW1scD0idX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VkaWVuY2VSZXN0cmljdGlvbj48L3NhbWw6Q29uZGl0aW9ucz48c2FtbDpBdXRoblN0YXRlbWVudCBBdXRobkluc3RhbnQ9IjIwMTYtMDgtMTBUMTk6MjA6MjhaIiBTZXNzaW9uSW5kZXg9ImlkLXZNVy0zckstdlJlb2V1T2Q1QXRWOEpiLVFRNENtUTB6RzQ1ZlRZSjEiIFNlc3Npb25Ob3RPbk9yQWZ0ZXI9IjIwMTYtMDgtMTBUMjA6MjA6MjhaIj48c2FtbDpBdXRobkNvbnRleHQ+PHNhbWw6QXV0aG5Db250ZXh0Q2xhc3NSZWY+TERBUFNjaGVtZV9HUklOPC9zYW1sOkF1dGhuQ29udGV4dENsYXNzUmVmPjwvc2FtbDpBdXRobkNvbnRleHQ+PC9zYW1sOkF1dGhuU3RhdGVtZW50Pjwvc2FtbDpBc3NlcnRpb24+PC9zYW1scDpSZXNwb25zZT4='; - const samlResponse = new Buffer(encodedSamlResponse, 'base64').toString(); + const samlResponse = new Buffer.from(encodedSamlResponse, 'base64').toString(); var options = { cert: cert, thumbprint: '5CA6E1202EAFC0A63A5B93A43572EB2376FED309', @@ -318,7 +318,7 @@ describe('samlp (unit tests)', function () { it('should return profile even if the namespace is in response element and assertion is signed', function(done){ var cert = fs.readFileSync(__dirname + '/test-auth0.cer'); var encodedSamlResponse = 'PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzYW1scDpSZXNwb25zZSB4bWxuczpzYW1scD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb3RvY29sIiB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyIgeG1sbnM6ZW5jPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGVuYyMiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iIHhtbG5zOng1MDA9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD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lKMSIgU2Vzc2lvbk5vdE9uT3JBZnRlcj0iMjAxNi0wOC0xMFQyMDoyMDoyOFoiPjxzYW1sOkF1dGhuQ29udGV4dD48c2FtbDpBdXRobkNvbnRleHRDbGFzc1JlZj5MREFQU2NoZW1lX0dSSU48L3NhbWw6QXV0aG5Db250ZXh0Q2xhc3NSZWY+PC9zYW1sOkF1dGhuQ29udGV4dD48L3NhbWw6QXV0aG5TdGF0ZW1lbnQ+PC9zYW1sOkFzc2VydGlvbj48L3NhbWxwOlJlc3BvbnNlPg=='; - const samlResponse = new Buffer(encodedSamlResponse, 'base64').toString(); + const samlResponse = new Buffer.from(encodedSamlResponse, 'base64').toString(); var options = { cert: cert, thumbprint: '5CA6E1202EAFC0A63A5B93A43572EB2376FED309', @@ -338,7 +338,7 @@ describe('samlp (unit tests)', function () { it('should return profile even if the namespace is in response element', function(done){ var cert = fs.readFileSync(__dirname + '/test-auth0.cer'); var encodedSamlResponse = 'PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzYW1scDpSZXNwb25zZSB4bWxuczpzYW1scD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb3RvY29sIiB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyIgeG1sbnM6ZW5jPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGVuYyMiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iIHhtbG5zOng1MDA9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpwcm9maWxlczphdHRyaWJ1dGU6WDUwMCIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgRGVzdGluYXRpb249Imh0dHBzOi8vYXZpbGxhY2hsYWIuYXV0aDAuY29tL2xvZ2luL2NhbGxiYWNrP2Nvbm5lY3Rpb249Q0hPU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- const samlResponse = new Buffer(encodedSamlResponse, 'base64').toString(); + const samlResponse = new Buffer.from(encodedSamlResponse, 'base64').toString(); var options = { cert: cert, thumbprint: '5CA6E1202EAFC0A63A5B93A43572EB2376FED309', @@ -357,7 +357,7 @@ describe('samlp (unit tests)', function () { it('should return profile when attribute namespaces are defined in saml response', function(done){ var encodedSamlResponse = 'PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiB4bWxuczplbmM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvMDQveG1sZW5jIyIgeG1sbnM6c2FtbD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFzc2VydGlvbiIgeG1sbnM6eDUwMD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb2ZpbGVzOmF0dHJpYnV0ZTpYNTAwIiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9maXJlZ2xhc3MuZXUuYXV0aDAuY29tL2xvZ2luL2NhbGxiYWNrP2Nvbm5lY3Rpb249cHV0bmFtIiBJRD0iaWQtVERVNUw3WnVVU0p0ZWFMZzNXbzZVTEgtN1BId3JqWlZvQzlJQ29haCIgSW5SZXNwb25zZVRvPSJfYTBmNTgwZGYwNGMyZWIwMjE3MzUiIElzc3VlSW5zdGFudD0iMjAxNi0wOC0yOVQxOTozMzoyMloiIFZlcnNpb249IjIuMCI+CiAgPHNhbWw6SXNzdWVyIEZvcm1hdD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOm5hbWVpZC1mb3JtYXQ6ZW50aXR5Ij5odHRwczovL29hbS1zdGcucHV0bmFtLmNvbS9vYW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xwOlJlc3BvbnNlPg=='; - const samlResponse = new Buffer(encodedSamlResponse, 'base64').toString(); + const samlResponse = new Buffer.from(encodedSamlResponse, 'base64').toString(); var options = { thumbprint: '5CA6E1202EAFC0A63A5B93A43572EB2376FED309', checkExpiration: false, @@ -375,7 +375,7 @@ describe('samlp (unit tests)', function () { it('should return profile when saml response is encrypted', function(done){ var encodedSamlResponse = fs.readFileSync(__dirname + '/samples/encoded/samlresponse_encrypted_and_signed.txt').toString(); - const samlResponse = new Buffer(encodedSamlResponse, 'base64').toString(); + const samlResponse = new Buffer.from(encodedSamlResponse, 'base64').toString(); var options = { decryptionKey: fs.readFileSync(__dirname + '/test-auth0.key'), thumbprint: '119B9E027959CDB7C662CFD075D9E2EF384E445F', @@ -395,7 +395,7 @@ describe('samlp (unit tests)', function () { it('should accept the signature when the saml response has an embedded XML assertion', function(done){ var encodedSamlResponse = fs.readFileSync(__dirname + '/samples/encoded/samlresponse_encoded_xml.txt').toString(); var cert = fs.readFileSync(__dirname + '/test-auth0-2.cer').toString(); - const samlResponse = new Buffer(encodedSamlResponse, 'base64').toString(); + const samlResponse = new Buffer.from(encodedSamlResponse, 'base64').toString(); var options = { cert: cert, checkExpiration: false, @@ -416,7 +416,7 @@ describe('samlp (unit tests)', function () { it('should digest has an extra space', function(done){ var encodedSamlResponse = fs.readFileSync(__dirname + '/samples/encoded/samlresponse_extraspace.txt').toString(); var cert = fs.readFileSync(__dirname + '/test-auth0.cer').toString(); - const samlResponse = new Buffer(encodedSamlResponse, 'base64').toString(); + const samlResponse = new Buffer.from(encodedSamlResponse, 'base64').toString(); var options = { cert: cert, checkExpiration: false, @@ -436,7 +436,7 @@ describe('samlp (unit tests)', function () { it('should return profile for IBM saml response', function(done){ var cert = fs.readFileSync(__dirname + '/test-auth0.cer'); var encodedSamlResponse = 'PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzYW1scDpSZXNwb25zZSB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8w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J1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0ZSBOYW1lPSJVc2VySUQiIE5hbWVGb3JtYXQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6YmFzaWMiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlIHhzaTp0eXBlPSJ4czpzdHJpbmciPlk5QzRCTTgyNjwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjwvc2FtbDpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PC9zYW1sOkFzc2VydGlvbj48L3NhbWxwOlJlc3BvbnNlPg==' - const samlResponse = new Buffer(encodedSamlResponse, 'base64').toString(); + const samlResponse = new Buffer.from(encodedSamlResponse, 'base64').toString(); var options = { cert: cert, thumbprint: '5CA6E1202EAFC0A63A5B93A43572EB2376FED309', @@ -457,7 +457,7 @@ describe('samlp (unit tests)', function () { it('should reject signature wrapped response', function(done) { var encodedSamlResponse = 'PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzYW1scDpSZXNwb25zZSB4bWxuczpzYW1scD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb3RvY29sIiB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyIgeG1sbnM6ZW5jPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGVuYyMiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iIHhtbG5zOng1MDA9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpwcm9maWxlczphdHRyaWJ1dGU6WDUwMCIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgRGVzdGluYXRpb249Imh0dHBzOi8vYXZpbGxhY2hsYWIuYXV0aDAu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jwvc2FtbDpBc3NlcnRpb24+PC9zYW1scDpSZXNwb25zZT4='; var cert = fs.readFileSync(__dirname + '/test-auth0.cer').toString(); - var buffer = new Buffer(encodedSamlResponse, 'base64').toString(); + var buffer = new Buffer.from(encodedSamlResponse, 'base64').toString(); var xml = buffer.toString(); //Create version of response without signature @@ -474,7 +474,7 @@ describe('samlp (unit tests)', function () { //Put stripped version under SubjectConfirmationData of modified version var xmlWrapped = outer.replace(/]*\/>/, "" + stripped.replace('', "") + ""); - var newWrap = new Buffer(xmlWrapped, 'base64').toString(); + var newWrap = new Buffer.from(xmlWrapped, 'base64').toString(); var options = { cert: cert, checkExpiration: false, @@ -501,7 +501,7 @@ describe('samlp (unit tests)', function () { it('should error if the identityProviderUrl is not a string', function(done) { var options = {identityProviderUrl: 42}; this.samlp.getSamlRequestParams(options, function(err, result) { - expect(err).to.be.an.Error; + expect(err).to.be.an('error'); expect(err.message).to.equal('Invalid identity provider URL: 42'); expect(result).to.not.exist; done(); @@ -511,7 +511,7 @@ describe('samlp (unit tests)', function () { it('should error if the identityProviderUrl is a string but not a URL', function(done) { var options = {identityProviderUrl: 'not a URL'}; this.samlp.getSamlRequestParams(options, function(err, result) { - expect(err).to.be.an.Error; + expect(err).to.be.an('error'); expect(err.message).to.equal('Invalid identity provider URL: "not a URL"'); expect(result).to.not.exist; done(); @@ -539,7 +539,7 @@ describe('samlp (unit tests)', function () { expect(params).to.have.property('SAMLRequest'); var SAMLRequest = params.SAMLRequest; - zlib.inflateRaw(new Buffer(SAMLRequest, 'base64'), function (err, buffer) { + zlib.inflateRaw(new Buffer.from(SAMLRequest, 'base64'), function (err, buffer) { if (err) return done(err); var request = buffer.toString(); @@ -582,7 +582,7 @@ describe('samlp (unit tests)', function () { requestTemplate: 'http://idp.example.com/metadata.phphttp://idp.example.com/metadata.php_ce3d2948b4cf20146dee0a0b3dd6f69b6cf86f62d7http://sp.example.com/demo1/metadata.phpurn:oasis:names:tc:SAML:2.0:ac:classes:Passwordtest@exåmple.com'; - const SAMLResponse = new Buffer(xml, 'binary').toString('base64') + const SAMLResponse = new Buffer.from(xml, 'binary').toString('base64') const samlp = new Samlp({}); const response = samlp.decodeResponse({ body: { SAMLResponse: SAMLResponse } }); const doc = new xmldom.DOMParser().parseFromString(response); @@ -714,7 +714,7 @@ describe('samlp (unit tests)', function () { it('should decode the SAML response using the defined settings', function() { const xml = 'http://idp.example.com/metadata.phphttp://idp.example.com/metadata.php_ce3d2948b4cf20146dee0a0b3dd6f69b6cf86f62d7http://sp.example.com/demo1/metadata.phpurn:oasis:names:tc:SAML:2.0:ac:classes:Passwordtest@exåmple.com'; - const SAMLResponse = new Buffer(xml, 'binary').toString('base64') + const SAMLResponse = new Buffer.from(xml, 'binary').toString('base64') const samlp = new Samlp({ default_encoding: 'ISO-8859-1' }); const response = samlp.decodeResponse({ body: { SAMLResponse: SAMLResponse } }); const doc = new xmldom.DOMParser().parseFromString(response); @@ -726,7 +726,7 @@ describe('samlp (unit tests)', function () { it('should decode the SAML response using default settings when invalid encoding', function() { const xml = 'http://idp.example.com/metadata.phphttp://idp.example.com/metadata.php_ce3d2948b4cf20146dee0a0b3dd6f69b6cf86f62d7http://sp.example.com/demo1/metadata.phpurn:oasis:names:tc:SAML:2.0:ac:classes:Passwordtest@exåmple.com'; - const SAMLResponse = new Buffer(xml, 'binary').toString('base64') + const SAMLResponse = new Buffer.from(xml, 'binary').toString('base64') const samlp = new Samlp({ default_encoding: 'foo' }); const response = samlp.decodeResponse({ body: { SAMLResponse: SAMLResponse } }); const doc = new xmldom.DOMParser().parseFromString(response); @@ -739,7 +739,7 @@ describe('samlp (unit tests)', function () { it('should get the encoding from the xml tag and decode with the correct encoding', function() { const xml = 'http://idp.example.com/metadata.phphttp://idp.example.com/metadata.php_ce3d2948b4cf20146dee0a0b3dd6f69b6cf86f62d7http://sp.example.com/demo1/metadata.phpurn:oasis:names:tc:SAML:2.0:ac:classes:Passwordtest@exåmple.com'; - const SAMLResponse = new Buffer(xml, 'binary').toString('base64') + const SAMLResponse = new Buffer.from(xml, 'binary').toString('base64') const samlp = new Samlp({}); const response = samlp.decodeResponse({ body: { SAMLResponse: SAMLResponse } }); const doc = new xmldom.DOMParser().parseFromString(response); @@ -751,7 +751,7 @@ describe('samlp (unit tests)', function () { it('should get the encoding from the xml tag and don\'t encode again because it is not valid', function() { const xml = 'http://idp.example.com/metadata.phphttp://idp.example.com/metadata.php_ce3d2948b4cf20146dee0a0b3dd6f69b6cf86f62d7http://sp.example.com/demo1/metadata.phpurn:oasis:names:tc:SAML:2.0:ac:classes:Passwordtest@exåmple.com'; - const SAMLResponse = new Buffer(xml, 'binary').toString('base64') + const SAMLResponse = new Buffer.from(xml, 'binary').toString('base64') const samlp = new Samlp({}); const response = samlp.decodeResponse({ body: { SAMLResponse: SAMLResponse } }); const doc = new xmldom.DOMParser().parseFromString(response); @@ -764,7 +764,7 @@ describe('samlp (unit tests)', function () { it('should get the encoding from the xml tag and decode using utf-8', function() { const xml = 'http://idp.example.com/metadata.phphttp://idp.example.com/metadata.php_ce3d2948b4cf20146dee0a0b3dd6f69b6cf86f62d7http://sp.example.com/demo1/metadata.phpurn:oasis:names:tc:SAML:2.0:ac:classes:Passwordtest@exåmple.com'; - const SAMLResponse = new Buffer(xml, 'binary').toString('base64') + const SAMLResponse = new Buffer.from(xml, 'binary').toString('base64') const samlp = new Samlp({}); const response = samlp.decodeResponse({ body: { SAMLResponse: SAMLResponse } }); const doc = new xmldom.DOMParser().parseFromString(response); diff --git a/test/state/samlp.state.custom.tests.js b/test/state/samlp.state.custom.tests.js index e479290..428405a 100644 --- a/test/state/samlp.state.custom.tests.js +++ b/test/state/samlp.state.custom.tests.js @@ -130,7 +130,7 @@ describe('samlp - using custom session state store', function() { }); strategy._samlp.validateSamlResponse = function(token, done) { - expect(token).to.be.an.object; + expect(token).to.be.an('object'); done(null, { id: '1234' }); }; @@ -160,12 +160,12 @@ describe('samlp - using custom session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Hello'); }); @@ -254,7 +254,7 @@ describe('samlp - using custom session state store', function() { }); strategy._samlp.validateSamlResponse = function(token, done) { - expect(token).to.be.an.object; + expect(token).to.be.an('object'); done(null, { id: '1234' }); }; @@ -283,14 +283,14 @@ describe('samlp - using custom session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info with state', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(Object.keys(info)).to.have.length(1); - expect(info.state).to.be.an.object; + expect(info.state).to.be.an('object'); expect(info.state.returnTo).to.equal('http://www.example.com/'); }); @@ -313,7 +313,7 @@ describe('samlp - using custom session state store', function() { }); strategy._samlp.validateSamlResponse = function(token, done) { - expect(token).to.be.an.object; + expect(token).to.be.an('object'); done(null, { id: '1234' }); }; @@ -342,15 +342,15 @@ describe('samlp - using custom session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info with state', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(Object.keys(info)).to.have.length(2); expect(info.message).to.equal('Hello'); - expect(info.state).to.be.an.object; + expect(info.state).to.be.an('object'); expect(info.state.returnTo).to.equal('http://www.example.com/'); }); diff --git a/test/state/samlp.state.session.tests.js b/test/state/samlp.state.session.tests.js index 3b4dde7..d998131 100644 --- a/test/state/samlp.state.session.tests.js +++ b/test/state/samlp.state.session.tests.js @@ -121,7 +121,7 @@ describe('samlp - using default session state store', function() { }); strategy._samlp.validateSamlResponse = function(token, done) { - expect(token).to.be.an.object; + expect(token).to.be.an('object'); done(null, { id: '1234' }); }; @@ -153,12 +153,12 @@ describe('samlp - using default session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Hello'); }); @@ -196,12 +196,12 @@ describe('samlp - using default session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Hello'); }); @@ -236,7 +236,7 @@ describe('samlp - using default session state store', function() { }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Invalid authorization request state.'); }); @@ -272,7 +272,7 @@ describe('samlp - using default session state store', function() { }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Unable to verify authorization request state.'); }); @@ -305,7 +305,7 @@ describe('samlp - using default session state store', function() { }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Unable to verify authorization request state.'); }); @@ -357,7 +357,7 @@ describe('samlp - using default session state store', function() { }); strategy._samlp.validateSamlResponse = function(token, done) { - expect(token).to.be.an.object; + expect(token).to.be.an('object'); done(null, { id: '1234' }); }; @@ -423,12 +423,12 @@ describe('samlp - using default session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Hello'); }); diff --git a/test/state/wsfed.state.custom.tests.js b/test/state/wsfed.state.custom.tests.js index 7c103f4..aeec369 100644 --- a/test/state/wsfed.state.custom.tests.js +++ b/test/state/wsfed.state.custom.tests.js @@ -125,7 +125,7 @@ describe('wsfed - using custom session state store', function() { }); strategy._wsfed.extractToken = function(req) { - expect(req).to.be.an.object; + expect(req).to.be.an('object'); return '...'; }; @@ -160,12 +160,12 @@ describe('wsfed - using custom session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Hello'); }); @@ -253,7 +253,7 @@ describe('wsfed - using custom session state store', function() { }); strategy._wsfed.extractToken = function(req) { - expect(req).to.be.an.object; + expect(req).to.be.an('object'); return '...'; }; @@ -287,14 +287,14 @@ describe('wsfed - using custom session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info with state', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(Object.keys(info)).to.have.length(1); - expect(info.state).to.be.an.object; + expect(info.state).to.be.an('object'); expect(info.state.returnTo).to.equal('http://www.example.com/'); }); @@ -316,7 +316,7 @@ describe('wsfed - using custom session state store', function() { }); strategy._wsfed.extractToken = function(req) { - expect(req).to.be.an.object; + expect(req).to.be.an('object'); return '...'; }; @@ -350,15 +350,15 @@ describe('wsfed - using custom session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info with state', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(Object.keys(info)).to.have.length(2); expect(info.message).to.equal('Hello'); - expect(info.state).to.be.an.object; + expect(info.state).to.be.an('object'); expect(info.state.returnTo).to.equal('http://www.example.com/'); }); diff --git a/test/state/wsfed.state.session.tests.js b/test/state/wsfed.state.session.tests.js index 3c4bf3d..943c301 100644 --- a/test/state/wsfed.state.session.tests.js +++ b/test/state/wsfed.state.session.tests.js @@ -117,7 +117,7 @@ describe('wsfed - using default session state store', function() { }); strategy._wsfed.extractToken = function(req) { - expect(req).to.be.an.object; + expect(req).to.be.an('object'); return '...'; }; @@ -154,12 +154,12 @@ describe('wsfed - using default session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Hello'); }); @@ -197,12 +197,12 @@ describe('wsfed - using default session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Hello'); }); @@ -237,7 +237,7 @@ describe('wsfed - using default session state store', function() { }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Invalid authorization request state.'); }); @@ -273,7 +273,7 @@ describe('wsfed - using default session state store', function() { }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Unable to verify authorization request state.'); }); @@ -306,7 +306,7 @@ describe('wsfed - using default session state store', function() { }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Unable to verify authorization request state.'); }); @@ -357,7 +357,7 @@ describe('wsfed - using default session state store', function() { }); strategy._wsfed.extractToken = function(req) { - expect(req).to.be.an.object; + expect(req).to.be.an('object'); return '...'; }; @@ -428,12 +428,12 @@ describe('wsfed - using default session state store', function() { }); it('should supply user', function() { - expect(user).to.be.an.object; + expect(user).to.be.an('object'); expect(user.id).to.equal('1234'); }); it('should supply info', function() { - expect(info).to.be.an.object; + expect(info).to.be.an('object'); expect(info.message).to.equal('Hello'); });