mirror of
https://github.com/hanzoai/passport-saml.git
synced 2026-09-24 17:01:45 +00:00
Make protocol configurable
This commit is contained in:
@@ -39,7 +39,8 @@ passport.use(new SamlStrategy(
|
||||
{
|
||||
path: '/login/callback',
|
||||
entryPoint: 'https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php',
|
||||
issuer: 'passport-saml'
|
||||
issuer: 'passport-saml',
|
||||
protocol: 'http://'
|
||||
},
|
||||
function(profile, done) {
|
||||
if (!profile.email) {
|
||||
|
||||
@@ -9,6 +9,11 @@ SAML.prototype.initialize = function (options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (!options.protocol) {
|
||||
options.protocol = 'https://';
|
||||
}
|
||||
|
||||
if (!options.path) {
|
||||
options.path = '/saml/consume';
|
||||
}
|
||||
@@ -39,13 +44,11 @@ SAML.prototype.generateInstant = function () {
|
||||
};
|
||||
|
||||
SAML.prototype.generateRequest = function (req) {
|
||||
var http = "http://";
|
||||
var https = "https://";
|
||||
var id = "_" + this.generateUniqueID();
|
||||
var instant = this.generateInstant();
|
||||
|
||||
// Post-auth destination
|
||||
var callbackUrl = https + req.headers.host + this.options.path;
|
||||
var callbackUrl = this.options.protocol + req.headers.host + this.options.path;
|
||||
|
||||
var request =
|
||||
"<samlp:AuthnRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" ID=\"" + id + "\" Version=\"2.0\" IssueInstant=\"" + instant + "\" ProtocolBinding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\" AssertionConsumerServiceURL=\"" + callbackUrl + "\">" +
|
||||
|
||||
Reference in New Issue
Block a user