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