Circular redicrect and case sensitive urisHello again<div><br></div><div>I might be missing something very trivial here....apologies if I do.</div><div><br></div><div>I to have bumped into the circular redirects between the RP and the passive STS, and my understanding of the cause makes very little sense, so I have to assume I misunderstand something.</div><div><br></div><div>The circular redirect - where the RP redirects to the STS which redirects to the RP which redirects back to the STS and so forth, is happening when there is a case-sensitive mismatch between the url I type for the RP in the browsers and the uri in IIS (the virtual directory name)</div><div><br></div><div>So - if I have a virtual directory called TestPortal and I browse to http://localhost/TestPortal everything works finel; if, however, I browse to http://localhost/testportal I get the circular redirect.</div><div><br></div><div>If I changed the casing of the Vdir (which is not a one step, as the IIS manager, like the FS, is not case sensitive) to be &quot;testportal&quot; then the opposite occures - requests for http://localhost/testportal work and requests to http://localhost/TestPortal don't.</div><div><br></div><div>All of this seems to be irrespective of what's in the Realm and AudienceUri for the RP.</div><div><br></div><div>This seems odd, especially as I can't control what the users are going to type in the browser....to the point that I doubt I got it right....why is this happening then? how I can I ensure the problem never appears? </div><div><br></div><div>Thanks</div><div><br></div><div>Yossi</div><hr class="sig">Yossi Dahan© 2009 Microsoft Corporation. All rights reserved.Wed, 20 May 2009 14:39:30 Zb5715cbe-6db0-4f59-a26e-f26d2c90ef26http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#b5715cbe-6db0-4f59-a26e-f26d2c90ef26http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#b5715cbe-6db0-4f59-a26e-f26d2c90ef26Yossi Dahanhttp://social.msdn.microsoft.com/Profile/en-US/?user=Yossi%20DahanCircular redicrect and case sensitive urisHello again<div><br></div><div>I might be missing something very trivial here....apologies if I do.</div><div><br></div><div>I to have bumped into the circular redirects between the RP and the passive STS, and my understanding of the cause makes very little sense, so I have to assume I misunderstand something.</div><div><br></div><div>The circular redirect - where the RP redirects to the STS which redirects to the RP which redirects back to the STS and so forth, is happening when there is a case-sensitive mismatch between the url I type for the RP in the browsers and the uri in IIS (the virtual directory name)</div><div><br></div><div>So - if I have a virtual directory called TestPortal and I browse to http://localhost/TestPortal everything works finel; if, however, I browse to http://localhost/testportal I get the circular redirect.</div><div><br></div><div>If I changed the casing of the Vdir (which is not a one step, as the IIS manager, like the FS, is not case sensitive) to be &quot;testportal&quot; then the opposite occures - requests for http://localhost/testportal work and requests to http://localhost/TestPortal don't.</div><div><br></div><div>All of this seems to be irrespective of what's in the Realm and AudienceUri for the RP.</div><div><br></div><div>This seems odd, especially as I can't control what the users are going to type in the browser....to the point that I doubt I got it right....why is this happening then? how I can I ensure the problem never appears? </div><div><br></div><div>Thanks</div><div><br></div><div>Yossi</div><hr class="sig">Yossi DahanTue, 25 Nov 2008 12:42:12 Z2008-11-25T12:42:12Zhttp://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#65dc739b-a52a-4295-90c8-7b1e4f7712f0http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#65dc739b-a52a-4295-90c8-7b1e4f7712f0Abhijeet Gaiha - Microsofthttp://social.msdn.microsoft.com/Profile/en-US/?user=Abhijeet%20Gaiha%20-%20MicrosoftCircular redicrect and case sensitive uris Hi Yossi,<br><br>If your RP is based on the Geneva Framework, can you provide me with the Audience URIs that you configured for your RP?<br><br>Thanks,<br>Abhijeet.Wed, 26 Nov 2008 01:43:00 Z2008-11-26T01:43:00Zhttp://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#0385653c-67c8-4b98-b036-060492c86e67http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#0385653c-67c8-4b98-b036-060492c86e67Yossi Dahanhttp://social.msdn.microsoft.com/Profile/en-US/?user=Yossi%20DahanCircular redicrect and case sensitive uris<span><div style="overflow:auto;background-color:white;border:solid 1px #7f9db9;width:;height:;line-height:100% !important;font-family:Courier New;font-size:11px"></div></span><span class=Apple-style-span style="border-collapse:collapse;font-family:'Courier New';font-size:11px;line-height:11px"><br></span>In one of my tests I've put <div><br><div><div><span><div style="overflow-x:auto;overflow-y:auto;background-color:white;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-color:rgb(127, 157, 185);border-right-color:rgb(127, 157, 185);border-bottom-color:rgb(127, 157, 185);border-left-color:rgb(127, 157, 185);line-height:100% !important;font-family:'Courier New';font-size:11px"><table cellpadding=0 cellspacing=0 style="width:99%;margin-top:2px;margin-right:0px;margin-bottom:2px;margin-left:0px;border-collapse:collapse;border-bottom-style:solid;border-bottom-color:rgb(238, 238, 238);background-color:rgb(255, 255, 255);border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px"><col style="font-family:'Courier New';font-size:11px;padding-left:10px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(247, 247, 247);white-space:nowrap"><tbody><tr><td><font style="font-size:11px">    </font><font style="color:blue">&lt;</font><font style="font-size:11px">audienceUris</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)">      <font style="color:blue">&lt;</font><font style="font-size:11px">add </font><font style="color:red">value</font><font style="font-size:11px">=</font><font style="color:blue">&quot;https://localhost/TestPortal&quot;</font><font style="font-size:11px">/&gt; </font></td></tr><tr><td>    <font style="color:blue">&lt;/</font><font style="font-size:11px">audienceUris</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr></tbody></table></div></span></div><div><br></div><div>This does not seem to be case sensitive though - I could have put it all lower case with no impact.</div></div></div><hr class="sig">Yossi DahanThu, 27 Nov 2008 16:08:54 Z2008-11-27T16:08:54Zhttp://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#6d8721c6-53ff-4d9b-af27-97d7c02e91cchttp://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#6d8721c6-53ff-4d9b-af27-97d7c02e91ccPeter Kron - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20Kron%20-%20MSFTCircular redicrect and case sensitive uris The problem stems partially from the way cookies are managed by the browsers. Only cookies for the requested domain and path are included with the request, and the path portion of the URL (TestPortal in your case) is case-sensitive. <br><br>So the cookie is written for the path in the request (testportal) and is not included with requests for TestPortal. This will prevent you from authenticating at TestPortal.<br><br>The circular redirection is a bug in the Framework. The STS is redirecting back to the URL specified in the realm or the wreply, which is TestPortal. Since the cookie is not sent the previous authentication isn't recognized and a repeated request is sent to the STS. <br><br>This issue has been filed with the development team. As a workaround, you might add a handler to rewrite the requested path into a canonical form, such as lowercase.<br><br>Thank you for identifying this problem.Sat, 06 Dec 2008 23:59:04 Z2008-12-06T23:59:04Zhttp://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#97c8cd15-b752-4d0f-9e77-aa6d61c37f26http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#97c8cd15-b752-4d0f-9e77-aa6d61c37f26Yossi Dahanhttp://social.msdn.microsoft.com/Profile/en-US/?user=Yossi%20DahanCircular redicrect and case sensitive urisThanks for the reply Peter. <div><br></div><div>1. Would you be able to post a quick pointer into the handler I would need to write? I'm not generally deep into web development...</div><div>2. If I understand your reply correctly you are saying that the circular redirect is a bug that will be fixed, but you also say that the need to authenticate again if the user typed the &quot;wrong&quot; url casing will remain?</div><div><br></div><div>Can you explain that last point a bit more? I don't fully understand it...</div><div><br></div><div>Thanks in advance</div><div><br></div><div>Yossi</div><hr class="sig">Yossi Dahan Connected Systems MVPWed, 10 Dec 2008 09:41:02 Z2008-12-10T09:41:02Zhttp://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#ece19f88-3277-4024-9dbc-36ea73b41e11http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#ece19f88-3277-4024-9dbc-36ea73b41e11Peter Kron - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Peter%20Kron%20-%20MSFTCircular redicrect and case sensitive uris 1. I was thinking of an HttpHandler that would lowercase all the paths coming into the app, but I realize now that won't work... as seen in...<br><br>2. If the application path (virtual directory) is MyApplication, cookies written will be scoped by default to MyApplication. If the user types myapplication, the browser will not send the cookie back to the site. A handler won't work because the request is already cookieless. The app can't reauthenticate without the cookie.<br><br>To prevent this, you can specify the path that will scope the cookie to &quot;/&quot;. Then cookies will be sent to any path on the domain, and the domain is matched case-insensitively (if that's a word). That can be done in web.config. By default the path is the virtual path of the application.<br><br> <div style="border-bottom:#7f9db9 1px solid;border-left:#7f9db9 1px solid;line-height:100% !important;background-color:white;font-family:Courier New;font-size:11px;overflow:auto;border-top:#7f9db9 1px solid;border-right:#7f9db9 1px solid"> <table style="border-bottom:#eee 0px solid;border-right-width:0px;background-color:#fff;margin:2px 0px;width:99%;border-collapse:collapse;border-top-width:0px;border-left-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="border-bottom:#f7f7f7 1px solid;padding-left:10px;font-family:Courier New;white-space:nowrap;font-size:11px"> <tbody> <tr> <td><font style="font-size:11px"></font><font style="color:blue">&lt;</font><font style="font-size:11px">federatedAuthentication</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">  </font><font style="color:blue">&lt;</font><font style="font-size:11px">cookieHandler </font><font style="color:red">path</font><font style="font-size:11px">=</font><font style="color:blue">&quot;/&quot;</font><font style="font-size:11px"> </font><font style="color:blue">/&gt;</font><font style="font-size:11px"> </font></td></tr> <tr> <td></font><font style="color:blue">&lt;/</font><font style="font-size:11px">federatedAuthentication</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr></tbody></table></div>Sat, 13 Dec 2008 07:49:22 Z2008-12-13T07:49:22Zhttp://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#9ae9f58e-5cb6-4548-a532-6823b1cd94d9http://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#9ae9f58e-5cb6-4548-a532-6823b1cd94d9Yossi Dahanhttp://social.msdn.microsoft.com/Profile/en-US/?user=Yossi%20DahanCircular redicrect and case sensitive urisThanks Peter, <div><br></div><div>Initial test proves this to work, and that solution is good enough for me for now.</div><div><br></div><div>Thanks for picking this up.</div><div><br></div><div><br></div>Yossi Dahan | [To help others please mark replies as answers if you found them helpful]Sun, 14 Dec 2008 20:42:12 Z2008-12-16T11:06:33Zhttp://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#f268c57b-b0cc-4894-834c-ea106081eebehttp://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/b5715cbe-6db0-4f59-a26e-f26d2c90ef26#f268c57b-b0cc-4894-834c-ea106081eebeYossi Dahanhttp://social.msdn.microsoft.com/Profile/en-US/?user=Yossi%20DahanCircular redicrect and case sensitive urisI'm coming back to this now as I've just realised why this is not such a good idea! :-)<br/><br/>As far as I can tell, as the token with the cookie is now stored at the root of the domain, it would apply to any web site hosted in this domain.<br/><br/>so - if I have SomeDomain.com/ApplicationA and SomeDomain.Com/ApplicationB and a user tries to browse to ApplicationA she would be redirected to the STS, log in, and the cookie would be stored under SomeDomain.com.<br/><br/>What that user will now browse to ApplicationB, the STS would not be called again, the same token would be issued; this is OK if the user is allowed to use both and the claims are identical, but not so ok if the user should only be allowed to one app, or if the 2nd app requires a different set of claims.<br/>I thought the realm would come into play here (as both apps are different realms), but it does not seem to make a difference...<hr class="sig">Yossi Dahan | [To help others please mark replies as answers if you found them helpful]Wed, 20 May 2009 14:39:30 Z2009-05-20T14:39:30Z