Skip to content
This repository was archived by the owner on Jul 3, 2026. It is now read-only.
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
8 changes: 7 additions & 1 deletion lib/samlp.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ function buildSamlResponse(options) {
return SAMLResponse;
}

function nameIdentiferNotFoundErrorMessage(options) {
var baseMessage = 'No attribute was found to generate the nameIdentifier. We tried with: ';
var probes = Array.isArray(options.nameIdentifierProbes) ? options.nameIdentifierProbes.join(', ') : '';
return baseMessage + probes;
}

function getSamlResponse(options, user, callback) {
options.profileMapper = options.profileMapper || PassportProfileMapper;
options.signatureNamespacePrefix = typeof options.signatureNamespacePrefix === 'string' ? options.signatureNamespacePrefix : '' ;
Expand All @@ -64,7 +70,7 @@ function getSamlResponse(options, user, callback) {
var ni = profileMap.getNameIdentifier(options);

if (!ni || !ni.nameIdentifier) {
var error = new Error('No attribute was found to generate the nameIdentifier. We tried with: ' + (options.nameIdentifierProbes || []).join(', '));
var error = new Error(nameIdentiferNotFoundErrorMessage(options));
error.context = { user: user };
return callback(error);
}
Expand Down
Loading