hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: HttpClient and Siteminder
Date Wed, 22 Oct 2008 19:04:03 GMT
On Wed, 2008-10-22 at 08:32 -0700, Stone, Robert wrote:
> 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
> 

This exception is thrown when HttpClient fails to parse the redirect
URL.

> Looks like HttpClient doesn't like Siteminder URL but I am not clear why does client
try to process it?

In order to extract the target hostname.

>  Shouldn't it be processed and redirected  by the SM agent and not passed to HC at all?


I can't tell. I have not a slightest idea about Siteminder

Oleg

> What am I missing?
> 
> Regards,
> 
> Bob Stone
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message