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

disable requested authentication context #5

Merged
merged 5 commits into from
Oct 1, 2018
Merged
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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ npm install apostrophe-saml
// your identity provider may result in mysterious failed logins.
// Make sure they are on board with what this URL has been set to
callbackUrl: 'https://example.com/auth/saml/login/callback'
//
// OPTIONAL: Extra passport-saml options
// Configuring saml in your environment can be tricky, and most
// environments have unique aspects to them that aren't handled
// directly by this wrapper. To help with this problem, you can
// pass extra passport-saml options through the following object.
// More details about available options can be found here:
// https://github.com/bergie/passport-saml#config-parameter-details
//
// passportSamlOptions: {
// disableRequestedAuthnContext: true,
// logoutUrl: 'https://examples.com/auth/saml/SLO',
// forceAuthn: true
// }
},
'apostrophe-login': {
// OPTIONAL: disable regular site logins completely
Expand Down
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ module.exports = {
// passport-saml uses entryPoint, not identityProviderUrl
config.entryPoint = config.identityProviderUrl;
config.callbackUrl = options.callbackUrl || (options.apos.options.baseUrl + '/auth/saml/login/callback');

//Add our extra passportSamlOptions into our config object
config = self.addPassportSamlOptions(config);

var strategy = new passportSaml.Strategy(
config,
self.profileCallback
Expand Down Expand Up @@ -85,6 +87,12 @@ module.exports = {
return '/auth/saml/login/callback';
}
};

self.addPassportSamlOptions = function(config) {
//merge the base configuration options into the passportSamlOptionsObject
//Note: if you have the same attribute in both objects, the base configuration option will overwrite the passportSamlOptions attribute {
return Object.assign({}, options.passportSamlOptions, config);
};

self.addRoutes = function() {
self.apos.app.get(self.getLoginPath(),
Expand Down