Skip to content

Commit

Permalink
Improve code consistency; fix error handling bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbarth committed Apr 29, 2019
1 parent a0fbc75 commit 1623809
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions multiSamlStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ MultiSamlStrategy.prototype.authenticate = function (req, options) {
});
};

MultiSamlStrategy.prototype.logout = function (req, options) {
MultiSamlStrategy.prototype.logout = function (req, callback) {
var self = this;

this._options.getSamlOptions(req, function (err, samlOptions) {
Expand All @@ -45,20 +45,24 @@ MultiSamlStrategy.prototype.logout = function (req, options) {
}

self._saml = new saml.SAML(Object.assign({}, self._options, samlOptions));
self.constructor.super_.prototype.logout.call(self, req, options);
self.constructor.super_.prototype.logout.call(self, req, callback);
});
};

MultiSamlStrategy.prototype.generateServiceProviderMetadata = function( req, decryptionCert, signingCert, next ) {
MultiSamlStrategy.prototype.generateServiceProviderMetadata = function( req, decryptionCert, signingCert, callback ) {
if (typeof callback !== 'function') {
throw new Error("Metadata can't be provided synchronously for MultiSamlStrategy.");
}

var self = this;

return this._options.getSamlOptions(req, function (err, samlOptions) {
if (err) {
return next(err);
return callback(err);
}

self._saml = new saml.SAML(samlOptions);
return next(null, self.constructor.super_.prototype.generateServiceProviderMetadata.call(self, decryptionCert, signingCert ));
self._saml = new saml.SAML(Object.assign({}, self._options, samlOptions));
return callback(null, self.constructor.super_.prototype.generateServiceProviderMetadata.call(self, decryptionCert, signingCert ));
});
};

Expand Down

0 comments on commit 1623809

Please sign in to comment.