简体   繁体   English

如何使用JSOUP中认证的HTTPS自签名登录

[英]How to login with HTTPS self-signed certified in JSOUP

I want to make an android app to do a login on the website of my school, the problem that I have is that the website works with HTTPS protocol and it has a self-signed protocol. 我想制作一个Android应用来在我学校的网站上进行登录,但是我遇到的问题是该网站可以使用HTTPS协议并且具有自签名协议。

I have been searching how can I perform the login doing a scrapping of the website with JSOUP but when try to connect to the website I got the next error 我一直在搜索如何使用JSOUP进行网站剪贴以执行登录,但是当尝试连接到网站时出现下一个错误

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚。

I've seen this site and also this site but i'm a little bit confused 我看过这个网站看过这个网站 ,但我有点困惑

What i want that you can help me is that if you have some kind of code that make it easier do the login or how can I do this in an easier way. 我希望您能为我提供帮助的是,如果您拥有某种使登录变得更容易的代码,或者我如何以一种更轻松的方式进行此操作。

Usually login into a web site requires two steps - 通常,登录网站需要两个步骤-
1. You send a get request to get the page, and you extract from there some values like session ID etc, and the cookies. 1.您发送一个get请求以获取页面,然后从那里提取一些值,例如会话ID等,以及cookie。
2. You send a post request with the values from step 1, and your user name and password. 2.您发送带有第1步中的值以及您的用户名和密码的post请求。
To know which values you need to send, use your browser in the developer mode (by pressing F12) and examine the traffic. 要知道您需要发送哪些值,请在开发人员模式下使用浏览器(按F12键)并检查流量。 If you want to write an android app, change the user agent string to match your browser, since some sites send different pages to different clients. 如果您要编写一个android应用,请更改user agent字符串以匹配您的浏览器,因为某些网站会将不同的页面发送给不同的客户端。 You can see an example here . 您可以在此处查看示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在JSoup中轻松使用HTTPS(自签名证书)? - How can I easily use HTTPS (self-signed certificate) with JSoup? kotlin连接到自签名https服务器 - kotlin connect to self-signed https server 如何在Grails上使用自签名证书创建https连接? - How can i create https connection with self-signed certificate on grails? 通过https的Java Web服务 - 如何将自签名证书添加到客户端API? - Java web service over https - How to add a self-signed certificate into a client api? 如何获取* .cer文件以将自签名HTTPS证书添加为Java信任 - How to get a *.cer file to add a self-signed HTTPS certificate as trusted for Java 如何在命令中获取* .cer文件以添加自签名HTTPS证书 - How to get a *.cer file to add a self-signed HTTPS certificate in command 如何使https:// localhost:port在嵌入式Jetty中使用自签名证书? - How to make https://localhost:port use self-signed certificate in embedded Jetty? 使用自签名证书将J2ME应用程序连接到https - connect J2ME application to https with self-signed certificate 在 Spring Boot 2.0 中使用自签名证书启用 HTTPS - Enable HTTPS with self-signed certificate in Spring Boot 2.0 使用自签名证书的Java ssl / https客户端 - Java ssl/https client using a self-signed certificate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM