node-saml / passport-saml

SAML 2.0 authentication with Passport
MIT License
861 stars 473 forks source link

SignatureValue not being checked? #268

Closed einarjohnson closed 6 years ago

einarjohnson commented 6 years ago

Hi. I am trying to verify a SAML2 response by sending a POST request to my SP setup. The token has a SignatureValue in it. It seems that the validateSignature function inside passport-saml/lib/passport-saml/saml.is never finds the needed signature object and returns false `var xpathSigQuery = ".//*[local-name(.)='Signature' and " + "namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']";

var signatures = xpath(currentNode, xpathSigQuery);

// This function is expecting to validate exactly one signature, so if we find more or fewer // than that, reject. if (signatures.length != 1) return false;`

My token looks like this `<?xml version="1.0" encoding="UTF-8"?>

Islyklar 3IHF2lkJL3gxyJ99C7z1lZGI6SBT5U9ZfwV3TBQNl4M= CD7KFLp3j0UizzWRTri/pOX+5nfai0BOmT/5KMwGOWViIyX74j/WXI7XdVjTS/Zfiziepimbo8eiWFKtgYlxLIzMHoICK8WYz+r7bZGdecvHV6xeTlVQcwDwna6grrOGzzvrWbrbiO8IDRld459bGg1KKqM0AM3Zpr/Kagnce+5egRGDeAWLPwGWyHfLF37BvAweZ9+sYV4LBEGXtILkgJqxQWsh/Yfe8qz49hxaIp3E5YYmvtBqRSfwyPJHjgGYeioz1JanO5v5hHihas+ZKCK7SRRY6QojY0wChB8pxbpivCwvZ3/BOY8lzdtpQryAmmQkPmB0HZa9yG3h6LGvkg== MIIGDDCCBPSgAwIBAgICHRwwDQYJKoZIhvcNAQEFBQAwgZIxCzAJBgNVBAYTAklTMRMwEQYDVQQFEwo1MjEwMDAyNzkwMRYwFAYDVQQKEw1BdWRrZW5uaSBlaGYuMSMwIQYDVQQLExpVdGdlZmFuZGkgYnVuYWRhcnNraWxyaWtqYTEWMBQGA1UECxMNTWlsbGlza2lscmlraTEZMBcGA1UEAxMQVHJhdXN0dXIgYnVuYWR1cjAeFw0xNjA3MTQxNTExMzdaFw0xODA3MTQxNTExMzdaMIHCMQswCQYDVQQGEwJJUzEeMBwGA1UECg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AjBggrBgEFBQcwAoYXaHR0cDovL29jc3AuYXVka2VubmkuaXMwPgYHYIJgAgFjBoYzaHR0cDovL2NkcC5hdWRrZW5uaS5pcy9za2lscmlraS90cmF1c3R1cmJ1bmFkdXIucDdiMAsGA1UdDwQEAwIF4DAfBgNVHSMEGDAWgBRv7NsRLAEDaxtgrrb4aNlAAc2OODBCBgNVHR8EOzA5MDegNaAzhjFodHRwOi8vY3JsLmF1ZGtlbm5pLmlzL3RyYXVzdHVyYnVuYWR1ci9sYXRlc3QuY3JsMB0GA1UdDgQWBBTXlBUp1axlTP9Rp2js7gSEmHKVzDANBgkqhkiG9w0BAQUFAAOCAQEABbDwqym5k1pmai/UL49pceeJnWSTvpZOabAYXOb/CeOM6iombgSgi/F8nXtZ49QCAZEdlB7S+jKL/6btqnWvE3FtaZpDzU1LdkzvUlJSYJlWCRgQV8g2uLz78QibychcIjlT2j0tx32TTg9kd64KX+k7/YjP+QJ1rpPkvWT7DNdJTrnLhCE01/qgGza2D+3c7Tav7WpqSv1CN7AY0RtDsEDBoH4os+5SRCX0+oOQ7ucv+nbaOYggzz06w7yfUdUQtrxS97fJwuH7hspD50lRdSlzKR38GPcL9E54OMz6Znw8ntw2htNZ1p0K/97sYJUUaHJWSM7u5655JyvpeEjKeA== Islyklar www.digidoktor.is urn:oasis:names:tc:SAML:2.0:ac:classes:TLSClient 2402596139 Bragi Leifur Hauksson Rafræn skilríki 10.121.57.25 1106773249 Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36 ` Also, my IDP posts this saml response to my POST binding using a variable named "_token_" and not "_SAMLResponse_". Can I configure this somehow using the framework?
markstos commented 6 years ago

Support requests are better addressed through StackOverflow with the passport-saml tag. No one is monitoring this queue to answer support requests.

https://stackoverflow.com/questions/tagged/passport-saml