Skip to content

Commit

Permalink
remove empty AttributeStatement element in Response when no attribute…
Browse files Browse the repository at this point in the history
…s (fix 139)
  • Loading branch information
damikael committed Jun 19, 2021
1 parent 6818202 commit 9b29f2b
Show file tree
Hide file tree
Showing 86 changed files with 91 additions and 256 deletions.
7 changes: 6 additions & 1 deletion spid-validator/server/lib/saml-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ class TestSuite {
}
}

compiled = compiled.replace("{{Attributes}}", attributesCompiled);
if(attributesCompiled!='') {
let attributeStatementCompiled = "<saml:AttributeStatement>" + attributesCompiled + "</saml:AttributeStatement>";
compiled = compiled.replace("{{Attributes}}", attributeStatementCompiled);
} else {
compiled = compiled.replace("{{Attributes}}", "");
}

} else {
compiled = compiled.replaceAll(e, eVal);
Expand Down
4 changes: 1 addition & 3 deletions spid-validator/test/base-nosession.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-08.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-09.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-10.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-109.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-11.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-110.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-12.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-13.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-16.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-17.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-19.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-20.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-21.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-22.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-23.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-25.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-26.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-27.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-28.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-29.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-30.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-31.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-33.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-34.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-35.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-36.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-37.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-38.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-39.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-40.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-41.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-42.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-43.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-44.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>
4 changes: 1 addition & 3 deletions spid-validator/test/case-45.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<saml:AuthnContextClassRef>{{AuthnContextClassRef}}</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
{{Attributes}}
</saml:AttributeStatement>
{{Attributes}}
</saml:Assertion>
</samlp:Response>

0 comments on commit 9b29f2b

Please sign in to comment.