Skip to content

Commit

Permalink
Merge fe7fa46 into b024735
Browse files Browse the repository at this point in the history
  • Loading branch information
natevecc committed Jan 26, 2021
2 parents b024735 + fe7fa46 commit 7ce0fbb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/libsaml.ts
Expand Up @@ -366,11 +366,12 @@ const libSaml = () => {
// normalise the certificate string
metadataCert = metadataCert.map(utility.normalizeCerString);

if (certificateNode.length === 0) {
// no certificate in response or metadata
if (metadataCert.length === 0 && metadataCert.length === 0) {
throw new Error('NO_SELECTED_CERTIFICATE');
}

// no certificate node in response
// certificate node in response
if (certificateNode.length !== 0) {
const x509CertificateData = certificateNode[0].firstChild.data;
const x509Certificate = utility.normalizeCerString(x509CertificateData);
Expand All @@ -386,6 +387,9 @@ const libSaml = () => {

sig.keyInfoProvider = new this.getKeyInfo(x509Certificate);

} else {
// no certificate node in response so just use the first cert in metadata
sig.keyInfoProvider = new this.getKeyInfo(metadataCert[0]);
}

}
Expand Down

0 comments on commit 7ce0fbb

Please sign in to comment.