1、Error Sending message to url endpoint
可能原因1:由于客户端与服务器均配置了SSL,注销时发生消息出错,这是由于SimpleHttpClient发送消息的方法中,仅支持HTTP方式:
public Boolean call() throws Exception {
HttpURLConnection connection = null;
BufferedReader in = null;
try {
LOGGER.debug("Attempting to access {}", url);
final URL logoutUrl = new URL(url);
final String output = "logoutRequest=" + URLEncoder.encode(message, "UTF-8");
connection = (HttpURLConnection) logoutUrl.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setReadTimeout(this.readTimeout);
connection.setConnectTimeout(this.connectionTimeout);
connection.setInstanceFollowRedirects(this.followRedirects);
connection.setRequestProperty("Content-Length", Integer.toString(output.getBytes().length));
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
final DataOutputStream printout = new DataOutputStream(connection.getOutputStream());
printout.writeBytes(output);
printout.flush();
printout.close();
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
boolean readInput = true;
while (readInput) {
readInput =StringUtils.isNotBlank(in.readLine());
}
LOGGER.debug("Finished sending message to {}", url);
return true;
} catch (final SocketTimeoutException e) {
LOGGER.warn("Socket Timeout Detected while attempting to send message to [{}]", url);
return false;
} catch (final Exception e) {
LOGGER.warn("Error Sending message to url endpoint [{}]. Error is [{}]", url, e.getMessage());
return false;
} finally {
IOUtils.closeQuietly(in);
if (connection != null) {
connection.disconnect();
}
}
}
可能原因2:客户端或服务器端使用localhost方式访问,如果使用服务器就会发送请求至localhost销毁ticket,而非注销客户端的ticket。可通过修改hosts解决。
2、web.xml配置过滤器的顺序错误,正确顺序为:
CAS Single Sign Out Filter
CASFilter
CAS Validation Filter
CAS HttpServletRequest Wrapper Filter
CAS Assertion Thread Local Filter