Skip to content

Commit

Permalink
Fixed issue where redirect uri query strings weren't included in redi…
Browse files Browse the repository at this point in the history
…rect query string param.
  • Loading branch information
tystol committed Sep 9, 2013
1 parent 5b06e80 commit bafc149
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ServiceStack.ServiceInterface/AuthenticateAttribute.cs
Expand Up @@ -93,7 +93,7 @@ protected bool DoHtmlRedirectIfConfigured(IHttpRequest req, IHttpResponse res, b
var url = req.ResolveAbsoluteUrl(htmlRedirect);
if (includeRedirectParam)
{
var absoluteRequestPath = req.ResolveAbsoluteUrl("~" + req.PathInfo);
var absoluteRequestPath = req.ResolveAbsoluteUrl("~" + req.RawUrl);
url = url.AddQueryParam("redirect", absoluteRequestPath);
}

Expand Down

4 comments on commit bafc149

@ajukraine
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mythz It's not good solution to concatenate here "" and req.RawUrl. Because, if we host application in IIS's application, for example "/App", then RawUrl might be "/App/Service" - and as result AppHost's resolver will take as argument "/App/Service", which will be resolved as "/App/App/Service". And that is obviously not good.

@mythz
Copy link
Member

@mythz mythz commented on bafc149 Sep 23, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajukraine you can provide your own custom url resolution strategy by overriding IAppHost.ResolveAbsoluteUrl in your AppHost.

@ajukraine
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mythz Yes, I know. This is what I've exactly done. But anyway, just a note that this place might cause problems.
Btw, here is my custom resolver:

public override string ResolveAbsoluteUrl(string virtualPath, IHttpRequest httpReq)
{
    // FIX: fixes case, when 'virtualPath' starts with "~{ApplicationName}"
    {
        string virtualAppPath = "~" + HostingEnvironment.ApplicationVirtualPath;
        if (virtualPath.StartsWith(virtualAppPath))
        {
            virtualPath = virtualPath.Remove(1, HostingEnvironment.ApplicationVirtualPath.Length);
        }
    }

    return base.ResolveAbsoluteUrl(virtualPath, httpReq);
}

@mythz
Copy link
Member

@mythz mythz commented on bafc149 Sep 23, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok nice, as it's opt-in I think we should also back this convention into the default impl, thx.

Please sign in to comment.