File: 222.coffee

package info (click to toggle)
node-xml2js 0.6.2%2B~cs15.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,312 kB
  • sloc: xml: 119; javascript: 7; makefile: 2
file content (52 lines) | stat: -rw-r--r-- 2,424 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
suite 'Tests specific to issues:', ->
  test 'Issue #222: Cant remove attribute heired from root', ->

    uuid = "24ff5e22-09af-42cc-aaf6-b475137e6304"
    xml = builder.begin({ encoding: 'utf-8' }).ele({
        "AuthnRequest": {
          "@ID": uuid,
          "@Version": "2.0",
          "@IssueInstant": "2019-07-28T18:02:19.511Z",
          "@Destination": "https://autenticacao.gov.pt/fa/Default.aspx",
          "@ProtocolBinding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST",
          "@AssertionConsumerServiceURL": "http://clav-auth.di.uminho.pt/assertion",
          "@ProviderName": "CLAV",
          "@xmlns":"urn:oasis:names:tc:SAML:2.0:protocol",
          "@xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance",
          "@xmlns:xsd":"http://www.w3.org/2001/XMLSchema",
          "@Consent":"urn:oasis:names:tc:SAML:2.0:consent:unspecified" 
        }
      }).ele(
        "Issuer", {
          "xmlns": "urn:oasis:names:tc:SAML:2.0:assertion"
        }, "http://clav-auth.di.uminho.pt"
      ).up().ele(
        "Extensions"
      ).ele(
        "fa:RequestedAttributes", {
          "xmlns:fa": "http://autenticacao.cartaodecidadao.pt/atributos"
        }
      ).ele(
        "fa:RequestedAttribute", {
          "Name": "http://interop.gov.pt/MDC/Cidadao/NIC", "NameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
        }
      )
    .end({ pretty: true })

    eq(
      xml

      """
      <AuthnRequest ID="24ff5e22-09af-42cc-aaf6-b475137e6304" Version="2.0" IssueInstant="2019-07-28T18:02:19.511Z" Destination="https://autenticacao.gov.pt/fa/Default.aspx" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" AssertionConsumerServiceURL="http://clav-auth.di.uminho.pt/assertion" ProviderName="CLAV" xmlns="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified">
        <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">http://clav-auth.di.uminho.pt</Issuer>
        <Extensions>
          <fa:RequestedAttributes xmlns:fa="http://autenticacao.cartaodecidadao.pt/atributos">
            <fa:RequestedAttribute Name="http://interop.gov.pt/MDC/Cidadao/NIC" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"/>
          </fa:RequestedAttributes>
        </Extensions>
      </AuthnRequest>
      """
    )