hessian,SSO,CAS调用https不受信任之跳过证书验证(unable to find valid certification path to requested target )
来源:互联网 发布:mp288打印机清零软件 编辑:程序博客网 时间:2024/06/01 08:10
本人在CAS进行单点登录的时候出现了地址为https,单点不能访问系统,报错unable to find valid certification path to requested target,其最终原因是缺少安全证书时出现的异常。以下是找到的2种解决办法
解决办法一:
public class SslUtil {public static CloseableHttpClient SslHttpClientBuild() {Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.INSTANCE).register("https", trustAllHttpsCertificates()).build();//创建ConnectionManager,添加Connection配置信息PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build();return httpClient;}private static SSLConnectionSocketFactory trustAllHttpsCertificates() {SSLConnectionSocketFactory socketFactory = null;TrustManager[] trustAllCerts = new TrustManager[1];TrustManager tm = new miTM();trustAllCerts[0] = tm;SSLContext sc = null;try {sc = SSLContext.getInstance("TLS");//sc = SSLContext.getInstance("TLS")sc.init(null, trustAllCerts, null);socketFactory = new SSLConnectionSocketFactory(sc, NoopHostnameVerifier.INSTANCE);//HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());} catch (NoSuchAlgorithmException e) {e.printStackTrace();} catch (KeyManagementException e) {e.printStackTrace();}return socketFactory;}static class miTM implements TrustManager, X509TrustManager {public X509Certificate[] getAcceptedIssuers() {return null;}public void checkServerTrusted(X509Certificate[] certs, String authType) {//don't check}public void checkClientTrusted(X509Certificate[] certs, String authType) {//don't check}}}
解决办法二:
http://blog.csdn.net/faye0412/article/details/6883879
阅读全文
0 0
- hessian,SSO,CAS调用https不受信任之跳过证书验证(unable to find valid certification path to requested target )
- Java进行https请求需要证书的问题 unable to find valid certification path to requested target
- 使用restful请求https身份不通过, unable to find valid certification path to requested target,使用java生成签名证书
- unable to find valid certification path to requested target'解决办法
- unable to find valid certification path to requested target
- unable to find valid certification path to requested target
- SunCertPathBuilderException: Unable To Find Valid Certification Path To Requested Target
- Unable to find valid certification path to requested target
- SunCertPathBuilderException: unable to find valid certification path to requested target
- unable to find valid certification path to requested target
- 彻底解决unable to find valid certification path to requested target
- 20170704unable to find valid certification path to requested target
- 【cas、tomcat】SunCertPathBuilderException: unable to find valid certification path to requested target
- 现https协议的服务异常:'unable to find valid certification path to requested target'
- HTTPS中SunCertPathBuilderException: unable to find valid certification path to requested target
- 请求https错误: unable to find valid certification path to requested target
- https请求报错解决: unable to find valid certification path to requested target
- 请求https错误: unable to find valid certification path to requested target
- PAT乙级 1037
- sys使用用户名密码的方式本地登录数据库服务器
- 购物车--可编辑
- GPU 命令行释放内存
- 一. PullToRefreshScrollView xml 整体下拉刷新上拉加载
- hessian,SSO,CAS调用https不受信任之跳过证书验证(unable to find valid certification path to requested target )
- 15分钟破解网站验证码
- 单例模式
- Python-变量赋值
- JS——闭包
- es5简单总结
- 属性动画
- iOS开发之NSURLSession/NSURLConnection HTTP load failed 的解决办法
- 安卓平板改装成电视盒子