Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Made AuthenticationHelper more robust.
Browse files Browse the repository at this point in the history
  • Loading branch information
leastprivilege committed Jun 17, 2013
1 parent 25e5776 commit 394b923
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,20 @@ public RelyingParty GetRelyingPartyDetailsFromReturnUrl(string returnUrl)
}

var url = HttpUtility.UrlDecode(returnUrl);
var message = WSFederationMessage.CreateFromUri(new Uri("http://foo.com" + url, UriKind.Absolute)) as SignInRequestMessage;
Uri uri;

if (message != null)
if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uri))
{
return GetRelyingPartyDetails(message.Realm);
WSFederationMessage message;

if (WSFederationMessage.TryCreateFromUri(uri, out message))
{
var signin = message as SignInRequestMessage;
if (signin != null)
{
return GetRelyingPartyDetails(signin.Realm);
}
}
}

return null;
Expand Down

0 comments on commit 394b923

Please sign in to comment.