CAS4 注销错误原因总结

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

转载于:https://my.oschina.net/toyo/blog/467907

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值