@@ -132,6 +132,31 @@ describe('saml 2.0', function () {
132132 assert . equal ( 'specific' , authnContextClassRef . textContent ) ;
133133 } ) ;
134134
135+ it ( 'should place signature where specified' , function ( ) {
136+ var options = {
137+ cert : fs . readFileSync ( __dirname + '/test-auth0.pem' ) ,
138+ key : fs . readFileSync ( __dirname + '/test-auth0.key' ) ,
139+ xpathToNodeBeforeSignature : "//*[local-name(.)='Conditions']" ,
140+ attributes : {
141+ 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress' :
'[email protected] ' , 142+ 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name' : 'Foo Bar' ,
143+ 'http://example.org/claims/testemptyarray' : [ ] , // should dont include empty arrays
144+ 'http://example.org/claims/testaccent' : 'fóo' , // should supports accents
145+ 'http://undefinedattribute/ws/com.com' : undefined
146+ }
147+ } ;
148+
149+ var signedAssertion = saml . create ( options ) ;
150+
151+ var isValid = utils . isValidSignature ( signedAssertion , options . cert ) ;
152+ assert . equal ( true , isValid ) ;
153+
154+ var doc = new xmldom . DOMParser ( ) . parseFromString ( signedAssertion ) ;
155+ var signature = doc . documentElement . getElementsByTagName ( 'Signature' ) ;
156+
157+ assert . equal ( 'saml:Conditions' , signature [ 0 ] . previousSibling . nodeName ) ;
158+ } ) ;
159+
135160 describe ( 'encryption' , function ( ) {
136161
137162 it ( 'should create a saml 2.0 signed and encrypted assertion' , function ( done ) {
0 commit comments