No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

52 líneas
1.6 KiB

  1. <!doctype html>
  2. <html lang="en-US">
  3. <body onload="run()">
  4. </body>
  5. </html>
  6. <script>
  7. 'use strict';
  8. function run () {
  9. var oauth2 = window.opener.swaggerUIRedirectOauth2;
  10. var sentState = oauth2.state;
  11. var isValid, qp;
  12. qp = (window.location.hash || location.search).substring(1);
  13. qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g, '":"') + '"}',
  14. function (key, value) {
  15. return key === "" ? value : decodeURIComponent(value)
  16. }
  17. ) : {}
  18. isValid = qp.state === sentState
  19. if (oauth2.auth.schema.get("flow") === "accessCode" && !oauth2.auth.code) {
  20. if (!isValid) {
  21. oauth2.errCb({
  22. authId: oauth2.auth.name,
  23. source: "auth",
  24. level: "warning",
  25. message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
  26. });
  27. }
  28. if (qp.code) {
  29. delete oauth2.state;
  30. oauth2.auth.code = qp.code;
  31. oauth2.callback(oauth2.auth);
  32. } else {
  33. oauth2.errCb({
  34. authId: oauth2.auth.name,
  35. source: "auth",
  36. level: "error",
  37. message: "Authorization failed: no accessCode received from the server"
  38. });
  39. }
  40. } else {
  41. oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid});
  42. }
  43. window.close();
  44. }
  45. </script>