Hi,
I'm trying to get access code for URL that is protected by Siteminder (SM).
Elsewhere in the code I'm getting SM cookie for the current user. Now I'm
trying to reuse this cookie to access URL and get the access code. The problem
is that instead of following redirect and getting actual URL I am getting
InvalidRedirectLocationException for the redirect URL of SM agent.
Here's cookie I'm adding (truncated)
JSESSIONID=9775B7EA48F0FEE86221B80B88FB214C; SMCHALLENGE=YES;
SMIDENTITY=OQGA6QPST1Ho82Qr...
Here's the code
String allCookies = getCurrentCookies();
HttpClient client = new HttpClient();
client.getHttpConnectionManager().getParams()
.setBooleanParameter(
"http.connection.stalecheck", true);
HttpMethod get = new GetMethod(location);
get.setFollowRedirects(true);
get.getParams().setCookiePolicy(
CookiePolicy.BROWSER_COMPATIBILITY);
get.setRequestHeader("Cookie", allCookies);
int rCode = client.executeMethod(get);
And here's the exception:
org.apache.commons.httpclient.InvalidRedirectLocationException: Invalid
redirect location:
https://logintest.foocomm.com/siteminderagent/nocert/1224689077/smgetcred.scc?TYPE=16777217&REALM=$SM$FoonetApps%20Dev%2fTest%20[08%3a24%3a37%3a8525]&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=$SM$VIKCnIwFQBmaHrauIuaDE0Vxdt37jIIv5x3U5CdHFaRgnjYIvMJC2kStw8Ioq%2byh&TARGET=$SM$http%3a%2f%2ffoonetapps-test%2efoocomm%2ecom%2fLegalContracts%2fpages%2fcontractsHome%2exhtml
Looks like HttpClient doesn't like Siteminder URL but I am not clear why does
client try to process it? Shouldn't it be processed and redirected by the SM
agent and not passed to HC at all? What am I missing?
Regards,
Bob Stone