aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-auth-saml/src/test/resources/samlAuthResultComplete.html
blob: fd3b9ac729a087126c12daa2221e6aa32f5eeae4 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png" />
    <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png" />
    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png" />
    <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png" />
    <link
      rel="apple-touch-icon"
      sizes="114x114"
      href="/apple-touch-icon-114x114.png"
    />
    <link
      rel="apple-touch-icon"
      sizes="120x120"
      href="/apple-touch-icon-120x120.png"
    />
    <link
      rel="apple-touch-icon"
      sizes="144x144"
      href="/apple-touch-icon-144x144.png"
    />
    <link
      rel="apple-touch-icon"
      sizes="152x152"
      href="/apple-touch-icon-152x152.png"
    />
    <link
      rel="apple-touch-icon"
      sizes="180x180"
      href="/apple-touch-icon-180x180.png"
    />
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    <meta name="application-name" content="SonarQube" />
    <meta name="msapplication-TileColor" content="#FFFFFF" />
    <meta name="msapplication-TileImage" content="/mstile-512x512.png" />
    <title>SAML Authentication Test</title>

    <style>
      body {
        background-color: #f3f3f3;
      }

      h1 {
        margin: 0 8px 8px;
      }
      h2 {
        margin: 0 0 8px;
      }

      ul {
        list-style: none;
        margin: 0 8px;
        padding: 0;
      }

      li + li {
        padding-top: 12px;
        margin-top: 12px;
        border-top: 1px solid rgba(150, 150, 150, 0.5);
      }

      table {
        border-collapse: collapse;
      }

      tr:nth-child(2n) {
        background-color: #e6e6e6;
      }

      td {
        border: 1px solid #a3a3a3;
        padding: 4px 24px 4px 8px;
        vertical-align: top;
        font-family: "Courier New", Courier, monospace;
      }

      #content {
        padding: 16px;
      }

      .box {
        padding: 8px;
        margin: 8px;
        border: 1px solid #e6e6e6;
        background-color: white;
        box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.5);
      }

      #status {
        padding: 16px 8px;
        font-size: large;
        color: white;
      }

      .error {
        background-color: #d02f3a;
      }

      .success {
        background-color: #008a25;
      }
    </style>
  </head>

  <body>
    <div id="content">
      <h1>SAML Authentication Test</h1>
      <div class="box">
        <div id="status"></div>
      </div>
    </div>

    <script>
      function createBox() {
        const box = document.createElement("div");
        box.className = "box";
        return box;
      }

      function createSectionTitle(title) {
        const node = document.createElement("h2");
        node.innerText = title;
        return node;
      }

      function createList(arr, className = "") {
        const list = document.createElement("ul");

        arr.forEach((item) => {
          const message = document.createElement("li");
          message.className = className;
          message.innerText = item;
          list.appendChild(message);
        });

        return list;
      }

      function createTable(obj) {
        const table = document.createElement("table");
        const tbody = document.createElement("tbody");
        table.appendChild(tbody);

        Object.keys(obj).forEach((key) => {
          const row = document.createElement("tr");

          const keyNode = document.createElement("td");
          keyNode.innerText = key;
          row.appendChild(keyNode);

          const valueNode = document.createElement("td");
          // wrap in array, to handle single values as well
          valueNode.innerHTML = [].concat(obj[key]).join("<br />");
          row.appendChild(valueNode);

          tbody.appendChild(row);
        });

        return table;
      }

      function addSection(container, title, contents) {
        const box = createBox();

        box.appendChild(createSectionTitle(title));
        box.appendChild(contents);

        container.appendChild(box);
      }

      const status = 'success';
      const attributes = {"key1":["value1","value2 with weird chars \n\t\"\\"],"key2":["value3","value4"]};
      const mappings = {"key1":["value1","value2"],"key2":["value3","value4"]};
      const errors = ['error1','error2 \'with message\''];
      const warnings = ['warning1','warning2 \'with message\''];

      // Switch status class
      const statusNode = document.querySelector("#status");
      statusNode.classList.add(status);
      statusNode.innerText = status;

      // generate content
      const container = document.querySelector("#content");

      if (warnings && warnings.length > 0) {
        addSection(container, "Warnings", createList(warnings));
      }

      if (status === "error" && errors && errors.length > 0) {
        addSection(container, "Errors", createList(errors));
      }

      if (status === "success") {
        if (attributes && Object.keys(attributes).length > 0) {
          addSection(container, "Available attributes", createTable(attributes));
        }

        if (mappings && Object.keys(mappings).length > 0) {
          addSection(container, "Attribute mappings", createTable(mappings));
        }
      }
    </script>
  </body>
</html>