Showing the changes to Source/Libraries/GSF.Web/Security/Scripts (2 of 6 files). Show all
Unified · Split
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | // boolean unsecureConnection: flag that indicates if connection is secure | 29 | // boolean unsecureConnection: flag that indicates if connection is secure |
| 30 | // string verificationHeader: HTTP header name used to transmit anti-forgery value | 30 | // string verificationHeader: HTTP header name used to transmit anti-forgery value |
| 31 | // string verificationValue: server generated anti-forgery verification token value | 31 | // string verificationValue: server generated anti-forgery verification token value |
| 32 | // string useAjaxVerfication: HTTP header named use to indicate an AJAX post | ||
| 32 | // string redirectPageLabel: user label for redirect location, e.g., main or target | 33 | // string redirectPageLabel: user label for redirect location, e.g., main or target |
| 33 | 34 | ||
| 34 | function loadSettings() { | 35 | function loadSettings() { |
| @@ -54,6 +55,7 @@ function authenticateBasic(username, password) { · 19 unmodified lines | |||
| 54 | $.ajax({ | 55 | $.ajax({ |
| 55 | cache: false, | 56 | cache: false, |
| 56 | url: securePage, | 57 | url: securePage, |
| 58 | type: "post", | ||
| 57 | complete: function (xhr) { | 59 | complete: function (xhr) { |
| 58 | switch (xhr.status) { | 60 | switch (xhr.status) { |
| 59 | case 200: | 61 | case 200: |
| @@ -70,6 +72,7 @@ function authenticateBasic(username, password) { · 10 unmodified lines | |||
| 70 | 72 | ||
| 71 | xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); | 73 | xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); |
| 72 | xhr.setRequestHeader(verificationHeader, verificationValue); | 74 | xhr.setRequestHeader(verificationHeader, verificationValue); |
| 75 | xhr.setRequestHeader(useAjaxVerfication, "true"); | ||
| 73 | } | 76 | } |
| 74 | }); | 77 | }); |
| 75 | } | 78 | } |
| @@ -85,7 +88,8 @@ function authenticateNTLM(username, password) { · 9 unmodified lines | |||
| 85 | loginComplete(true); | 88 | loginComplete(true); |
| 86 | else | 89 | else |
| 87 | loginFailed(response); | 90 | loginFailed(response); |
| 88 | }, verificationHeader, verificationValue); | 91 | }, |
| 92 | verificationHeader, verificationValue, useAjaxVerfication); | ||
| 89 | } | 93 | } |
| 90 | 94 | ||
| 91 | // Authorize user with pass-through basic authentication without credentials | 95 | // Authorize user with pass-through basic authentication without credentials |
| @@ -94,6 +98,7 @@ function passthroughBasic() { · 2 unmodified lines | |||
| 94 | $.ajax({ | 98 | $.ajax({ |
| 95 | cache: false, | 99 | cache: false, |
| 96 | url: securePage, | 100 | url: securePage, |
| 101 | type: "post", | ||
| 97 | complete: function (xhr) { | 102 | complete: function (xhr) { |
| 98 | switch (xhr.status) { | 103 | switch (xhr.status) { |
| 99 | case 200: | 104 | case 200: |
| @@ -106,6 +111,7 @@ function passthroughBasic() { · 6 unmodified lines | |||
| 106 | }, | 111 | }, |
| 107 | beforeSend: function (xhr) { | 112 | beforeSend: function (xhr) { |
| 108 | xhr.setRequestHeader(verificationHeader, verificationValue); | 113 | xhr.setRequestHeader(verificationHeader, verificationValue); |
| 114 | xhr.setRequestHeader(useAjaxVerfication, "true"); | ||
| 109 | } | 115 | } |
| 110 | }); | 116 | }); |
| 111 | } | 117 | } |
| @@ -116,6 +122,7 @@ function passthroughNTLM() { · 4 unmodified lines | |||
| 116 | $.ajax({ | 122 | $.ajax({ |
| 117 | cache: false, | 123 | cache: false, |
| 118 | url: securePage + "?scheme=NTLM", | 124 | url: securePage + "?scheme=NTLM", |
| 125 | type: "post", | ||
| 119 | complete: function (xhr) { | 126 | complete: function (xhr) { |
| 120 | if (xhr.status === 200) { | 127 | if (xhr.status === 200) { |
| 121 | loginComplete(true); | 128 | loginComplete(true); |
| @@ -131,6 +138,7 @@ function passthroughNTLM() { · 9 unmodified lines | |||
| 131 | }, | 138 | }, |
| 132 | beforeSend: function (xhr) { | 139 | beforeSend: function (xhr) { |
| 133 | xhr.setRequestHeader(verificationHeader, verificationValue); | 140 | xhr.setRequestHeader(verificationHeader, verificationValue); |
| 141 | xhr.setRequestHeader(useAjaxVerfication, "true"); | ||
| 134 | } | 142 | } |
| 135 | }); | 143 | }); |
| 136 | } | 144 | } |
| @@ -252,7 +252,7 @@ Ntlm.isChallenge = function(xhr) { · 251 unmodified lines | |||
| 252 | return header && header.indexOf("NTLM") !== -1; | 252 | return header && header.indexOf("NTLM") !== -1; |
| 253 | }; | 253 | }; |
| 254 | 254 | ||
| 255 | Ntlm.authenticate = function(url, handleResponse, verificationHeader, verificationValue) { | 255 | Ntlm.authenticate = function (url, handleResponse, verificationHeader, verificationValue, useAjaxVerfication) { |
| 256 | if (!Ntlm.domain || !Ntlm.username || !Ntlm.lmHashedPassword || !Ntlm.ntHashedPassword) { | 256 | if (!Ntlm.domain || !Ntlm.username || !Ntlm.lmHashedPassword || !Ntlm.ntHashedPassword) { |
| 257 | Ntlm.error("No NTLM credentials specified. Use Ntlm.setCredentials(...) before making calls."); | 257 | Ntlm.error("No NTLM credentials specified. Use Ntlm.setCredentials(...) before making calls."); |
| 258 | return; | 258 | return; |
| @@ -268,6 +268,7 @@ Ntlm.authenticate = function(url, handleResponse, verificationHeader, verificati · 9 unmodified lines | |||
| 268 | 268 | ||
| 269 | $.ajax({ | 269 | $.ajax({ |
| 270 | url: url, | 270 | url: url, |
| 271 | type: "post", | ||
| 271 | cache: false, | 272 | cache: false, |
| 272 | crossDomain: false, | 273 | crossDomain: false, |
| 273 | xhrFields: { | 274 | xhrFields: { |
| @@ -278,6 +279,7 @@ Ntlm.authenticate = function(url, handleResponse, verificationHeader, verificati · 4 unmodified lines | |||
| 278 | case 401: | 279 | case 401: |
| 279 | $.ajax({ | 280 | $.ajax({ |
| 280 | url: url, | 281 | url: url, |
| 282 | type: "post", | ||
| 281 | cache: false, | 283 | cache: false, |
| 282 | crossDomain: false, | 284 | crossDomain: false, |
| 283 | xhrFields: { | 285 | xhrFields: { |
| @@ -293,8 +295,10 @@ Ntlm.authenticate = function(url, handleResponse, verificationHeader, verificati · 9 unmodified lines | |||
| 293 | 295 | ||
| 294 | xhr2.setRequestHeader("Authorization", "NTLM " + msg3.toBase64()); | 296 | xhr2.setRequestHeader("Authorization", "NTLM " + msg3.toBase64()); |
| 295 | 297 | ||
| 296 | if (verificationHeader && verificationValue) | 298 | if (verificationHeader && verificationValue) { |
| 297 | xhr2.setRequestHeader(verificationHeader, verificationValue); | 299 | xhr2.setRequestHeader(verificationHeader, verificationValue); |
| 300 | xhr2.setRequestHeader(useAjaxVerfication, "true"); | ||
| 301 | } | ||
| 298 | } | 302 | } |
| 299 | }); | 303 | }); |
| 300 | break; | 304 | break; |
| @@ -307,8 +311,10 @@ Ntlm.authenticate = function(url, handleResponse, verificationHeader, verificati · 6 unmodified lines | |||
| 307 | const msg1 = Ntlm.createMessage1(hostname); | 311 | const msg1 = Ntlm.createMessage1(hostname); |
| 308 | xhr.setRequestHeader("Authorization", "NTLM " + msg1.toBase64()); | 312 | xhr.setRequestHeader("Authorization", "NTLM " + msg1.toBase64()); |
| 309 | 313 | ||
| 310 | if (verificationHeader && verificationValue) | 314 | if (verificationHeader && verificationValue) { |
| 311 | xhr.setRequestHeader(verificationHeader, verificationValue); | 315 | xhr.setRequestHeader(verificationHeader, verificationValue); |
| 316 | xhr.setRequestHeader(useAjaxVerfication, "true"); | ||
| 317 | } | ||
| 312 | } | 318 | } |
| 313 | }); | 319 | }); |
| 314 | }; | 320 | }; |