Commit 24f207e5 by chenzx

打印网络请求返回信息

parent dc337c2b
...@@ -82,9 +82,21 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -82,9 +82,21 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
map.put("clientSecret",clientSecret); map.put("clientSecret",clientSecret);
map.put("redirect_uri",ssoUrl); map.put("redirect_uri",ssoUrl);
map.put("code",code); map.put("code",code);
JSONObject jsonObject = JSONObject.fromObject(HttpClientUtil.doPost("http://cas.zua.edu.cn/oauth2.0/accessToken",map)); JSONObject jsonObject = null;
//返回内容 access_token=AT-1-vDqPefqwHJl39iUtsAh19oI1vwAIQn6k&expires_in=28800 try{
String accessToken=jsonObject.get("accessToken").toString(); jsonObject = JSONObject.fromObject(HttpClientUtil.doPost("http://cas.zua.edu.cn/oauth2.0/accessToken",map));
}catch (Exception e){
System.out.println(e.getMessage());
e.printStackTrace();
}
String accessToken="";
if(null != jsonObject){
//返回内容 access_token=AT-1-vDqPefqwHJl39iUtsAh19oI1vwAIQn6k&expires_in=28800
accessToken=jsonObject.get("accessToken").toString();
}else{
System.out.println("jsonObject is null");
}
if (!StringUtils.isEmpty(accessToken)){ if (!StringUtils.isEmpty(accessToken)){
httpServletResponse.sendRedirect("/refuse?code=402"); httpServletResponse.sendRedirect("/refuse?code=402");
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment