I am trying to access a website on my company intranet, and they use SSO. When I hit the site I am getting the SSO sign on page. However, if I were to hit the site via my browsers, or cURL, I am redirected to the expected page because I have already logged in. I tried doing:
Response response = Jsoup.connect(url).followRedirects(true).execute();
but was met with the same sign on page.
I have also tried using:
Response response = Jsoup.connect(url).followRedirects(false).execute();
System.out.println(response.header("location"));
This didn't work either. What is the best way to handle the SSO?
You may be missing some cookies.
Fire up your favorite browser and open its developer console. Try to connect to the site and observe the headers (cookies) exchanged by your brower.
Provide the same headers you have detected.