Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow for authnRequestBinding in SAML options (#529)
Co-authored-by: Mike Hesler <mhesler@grapevine6.com> Co-authored-by: Mike Hesler <mhesler@seismic.com> Co-authored-by: Chris Barth <chrisjbarth@hotmail.com>
- Loading branch information
1 parent
54704de
commit ed4be0c
Showing
5 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"use strict"; | ||
|
||
var sinon = require("sinon"); | ||
var saml = require("../lib/passport-saml/saml.js"); | ||
var SamlStrategy = require("../lib/passport-saml/index.js").Strategy; | ||
|
||
function verify() {} | ||
|
||
describe("strategy#authorize", function () { | ||
beforeEach(function () { | ||
this.getAuthorizeFormStub = sinon.stub(saml.SAML.prototype, "getAuthorizeForm"); | ||
this.getAuthorizeUrlStub = sinon.stub(saml.SAML.prototype, "getAuthorizeUrl"); | ||
}); | ||
|
||
afterEach(function () { | ||
this.getAuthorizeFormStub.restore(); | ||
this.getAuthorizeUrlStub.restore(); | ||
}); | ||
|
||
it("calls getAuthorizeForm when authnRequestBinding is HTTP-POST", function () { | ||
var strategy = new SamlStrategy( | ||
{ | ||
authnRequestBinding: "HTTP-POST", | ||
}, | ||
verify | ||
); | ||
strategy.authenticate({}, {}); | ||
sinon.assert.calledOnce(this.getAuthorizeFormStub); | ||
}); | ||
|
||
it("calls getAuthorizeUrl when authnRequestBinding is not HTTP-POST", function () { | ||
var strategy = new SamlStrategy({}, verify); | ||
strategy.authenticate({}, {}); | ||
sinon.assert.calledOnce(this.getAuthorizeUrlStub); | ||
}); | ||
}); |