Search code examples
javahttpclientsiteminder

Logging into SiteMinder using Java


As I am working on the project that is making a call to a url and that url is using siteminder so every time I make a request to that url

https://some-host/a/getmeta?id=10

it redirects me to some other url that contains siteminder thing

location: https://login.somehost.com/siteminderagent/nocert/1309460767/smgetcre
d.scc?TYPE=16777217&REALM=-SM-Documentum%20[12%3a06%3a07%3a4932]&SMAUTHREASON=0&
METHOD=GET&SMAGENTNAME=-SM-6D9yKpar83ASDc5Sb4KDjZtHgfZId%2fYHFKbzwYvx5EUeGMi0dOa
uGVx6wOk1daI3&TARGET=-SM-http%3A%2F%2Fsome-host%2Fa%2Fgetmeta%3Fid%3D10

And If I open this link into the browser then it ask for the username and password and If I provide the username and password then I get my actual content back..

So how can I authenticate everytime and I am using HTTPCLIENT 4.1.1.


Solution

  • Well, you can follow the redirect, fill in the fields and post the form. It will take you where you want to go.

    The fields are probably the standard USER and PASSWORD fields from siteminder. you just need to ensure your java code properly handles the redirects and maintains the cookie. The commons-httpclient does this for you pretty easily.