* <p>
* @param msg 校验消息
* @return 响应消息
*/
public static ResponseMessage checkTicket(RequestMessage msg) {
ResponseMessage respMsg = new ResponseMessage();
try {
String url = CommonConfig.getProp().getProperty("SSO_AUTHEN_URL") + "?T=" + msg.getTicket();
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
HttpResponse resp = client.execute(httpGet);
HttpEntity entity = resp.getEntity();
if (null != entity) {
byte[] data = EntityUtils.toByteArray(entity);
String plainData = CipherHelper.decrypt(data, CommonConfig.getProp().getProperty("D_KEY"));
if (null != plainData) {
respMsg = JsonHelper.jsonDeserialize(plainData, ResponseMessage.class);
}
else {
respMsg.setStatus(false);
respMsg.setCause("由于密码错误,导致解密失败!");
}
EntityUtils.consume(entity);
}
else {
respMsg.setStatus(false);
respMsg.setCause("没有响应数据!");
}
}
catch (Exception e) {
respMsg.setStatus(false);
respMsg.setCause("请求异常或响应解析失败!");
e.printStackTrace();
}
return respMsg;
}