smapsso.html 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  5. <meta charset="UTF-8">
  6. <title>登录中...</title>
  7. <script src="../o2_core/o2.min.js"></script>
  8. <script src="js/sso.min.js"></script>
  9. <script>
  10. o2.addReady(function(){
  11. o2.JSON.get("res/config/config.json", function(config){
  12. getServiceAddress(config, function(){
  13. var locate = window.location;
  14. var protocol = locate.protocol;
  15. var addressObj = layout.serviceAddressList["x_organization_assemble_authentication"];
  16. var address = protocol+"//"+addressObj.host+(addressObj.port==80 ? "" : ":"+addressObj.port)+"/z_sso_control/jaxrs/sso/smplogin";
  17. var uri = new URI(window.location.toString());
  18. var xtoken = uri.getData("SMAP_SESSION_DATA");
  19. var appID = uri.getData("appID");
  20. var uniqueId = uri.getData("uniqueId");
  21. var flushPortalUrl = uri.getData("flushPortalUrl") || "";
  22. if( flushPortalUrl && flushPortalUrl.indexOf("%2F") === -1 ){
  23. flushPortalUrl = encodeURIComponent(flushPortalUrl);
  24. }
  25. var redirect = uri.getData("redirect");
  26. redirect = redirect + "&uniqueId=" + uniqueId + "&flushPortalUrl="+flushPortalUrl;
  27. var nav = uri.getData("nav");
  28. if(nav)redirect = redirect + "&nav=" + nav;
  29. if (xtoken){
  30. var res = new Request.JSON({
  31. url: o2.filterUrl(address+"?SMAP_SESSION_DATA="+encodeURIComponent(xtoken)+"&appID="+appID+"&date="+(new Date()).getTime()),
  32. secure: false,
  33. method: "GET",
  34. noCache: true,
  35. withCredentials: true,
  36. onSuccess: function(responseJSON, responseText){
  37. var result = responseJSON.data.value;
  38. if(result){
  39. if (redirect){
  40. window.location = redirect;
  41. }else{
  42. window.location = "/";
  43. }
  44. }else{
  45. $("ssoerror").set("html","单点失败!"+responseJSON.message);
  46. $("ssoerror").show();
  47. }
  48. }.bind(this),
  49. onFailure: function(xhr){
  50. $("ssoerror").show();
  51. }.bind(this),
  52. onError: function(text, error){
  53. $("ssoerror").show();
  54. }.bind(this)
  55. });
  56. res.send();
  57. }else{
  58. $("ssoerror").set("html","单点失败,认证token为空!");
  59. $("ssoerror").show();
  60. }
  61. });
  62. });
  63. });
  64. </script>
  65. </head>
  66. <body style="background: rgb(239, 239, 244);">
  67. <div id="ssoerror" style="text-align:center;display:none;">单点失败,请联系管理员!</div>
  68. </body>
  69. </html>