AJAX登入集成CAS的项目获取用户信息
发布时间:2020-12-16 01:28:24 所属栏目:百科 来源:网络整理
导读:pre name="code" class="html"!doctype htmlhtml head title获取与CAS集成项目的用户信息/title meta http-equiv="X-UA-Compatible" content="IE=edge" meta charset="utf-8" meta content="yes" name="apple-mobile-web-app-capable" meta content="yes" na
<pre name="code" class="html"><!doctype html> <html> <head> <title>获取与CAS集成项目的用户信息</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="utf-8"> <meta content="yes" name="apple-mobile-web-app-capable"> <meta content="yes" name="apple-touch-fullscreen"> <meta content="telephone=no" name="format-detection"> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <meta content="#ffffff" name="msapplication-TileColor"> <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"> </head> <body> <div>hello</div> <script type="text/javascript" src="js/jquery-3.1.0.min.js"></script> <script type="text/javascript"> var username="11"; var password="111"; var ctx="http://chenyongtu.gicp.net"; var ctx_t=ctx+"/teenagers"; var ctx_c=ctx+"/cas"; var url_userinfo=ctx+"/teenagers/a/mobile/userInfoNew?mobileLogin=true" var _services="service="+ encodeURIComponent(ctx_t+"/a/myTest/testLogin"); var casUrl=ctx_c+"/login?"+_services+"&get-lt=true&n="+new Date().getTime(); $(document).ready( function(){ //getuserinfo(url_userinfo); getTL(casUrl); }); function getTL(url){ $.ajax({ url:url,type:'get',data:'',async : false,error:function(){ alert('error'); },success:function(result){ console.log(result); var data="lt="+result.split("&")[0]+"&execution="+result.split("&")[1].replace("/rn/g","").replace("/n/g","")+"&_eventId=submit&username="+username+"&password="+password+"&submit=%E7%99%BB%E5%BD%95"; var services="service="+encodeURIComponent(ctx_t+"/a/cas"); var url=ctx_c+"/login?"+services+"&"+data; console.log("url"+url); login(url); } }); } function login(url){ $.ajax({ url:url,type:'post',success:function(data){ console.log(data); getuserinfo(url_userinfo); } }); } function getuserinfo(url){ $.get(url,function(data){ console.log(data); }); } </script> </body> </html> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |