一.问题描述
用cas做单点登录时,前端跳转到cas登录页面,登录后报错
二.解决思路:
上面报错显示的是HttpClients发起请求时,url是https需要证书验证,所以在创建对象时要忽略掉ssl,代码如下
CloseableHttpClient httpClient = null;
SSLConnectionSocketFactory scsf = new SSLConnectionSocketFactory(
SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build(),
NoopHostnameVerifier.INSTANCE);
httpClient = HttpClients.custom().setSSLSocketFactory(scsf).build();