This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing webservices protected by SSO  RSS feed

 
lokesh kumar n
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I wrote a simple java client using java.net.URLConnection to connect to a webservice protected by SSO. I also extended the java.net.Authenticator and provided my own authenticator with user name and password for the SSO but stll I am not able to access the webservice from my java client.

Is there somthing that I am missing.
Can you please help me?

Thanks.
Lokesh
 
Kumar Raja
Ranch Hand
Posts: 548
2
Hibernate Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lokesh kumar n wrote:Hi,
I wrote a simple java client using java.net.URLConnection to connect to a webservice protected by SSO. I also extended the java.net.Authenticator and provided my own authenticator with user name and password for the SSO but stll I am not able to access the webservice from my java client.

Is there somthing that I am missing.
Can you please help me?

Thanks.
Lokesh


What is the error you are getting ?
 
lokesh kumar n
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kumar Raja,

Thanks for replying.

I am not getting any error, what I am getting as the response is that SSO login web page.
I am already setting the password through the Authenticator. How else should I pass the username and password?

Thanks,
Lokesh
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there is a login web page, then the SSO system most likely does not use Basic or Digest Authentication - which are the two cases java.net.Authenticator can handle.
You'd need to write client code that knows how to handle that login page, possibly using a library like HttpClient or HtmlUnit.
 
lokesh kumar n
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I used HttpClient and I also set the user/password using "((DefaultHttpClient)client).getCredentialsProvider().setCredentials(...)", now also it is returning the same sso login page, along with that I also get a warning:

Feb 19, 2011 2:58:20 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: ObFormLoginCookie][value: wh%3DEngg-STG%20wu%3D%2......". Illegal path attribute "/autho/dummy/dummy.html". Path of origin: "/obrareq.cgi"

Any idea on this.

Regards,
Lokesh
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used HttpClient and I also set the user/password using "((DefaultHttpClient)client).getCredentialsProvider().setCredentials(...)"

That, too, uses Basic or Digest authentication. If the SSO page uses Form authentication (make sure it does), then you need to write code that submits the form with all its parameters. That is most likely easier using HtmlUnit than HttpClient.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!