I'm probably not understanding something but I have the issue below:
AppHost.cs
Plugins.Add(new AuthFeature(
() => new AuthUserSession(),
new IAuthProvider[] { new BasicAuthProvider() }) { HtmlRedirect = null });
HomeController.cs
[Authenticate]
public class HomeController : ServiceStackController
The issue
The issue is that when I try to access the HomeController, I am redirected to ~/login?redirect=....
.
I would assume that by setting HtmlRedirect
to null, would also affect the MVC controllers too, but it doesn't seem to.
Is this expected behaviour? or is am I doing something wrong?
My end goal is to have the browser prompt with a challenge / response basic auth box.
I have been on the
ServiceStack
Jabbr chat page and was told that this is a bug and a fix will be put on today!https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.FluentValidation.Mvc3/Mvc/ExecuteServiceStackFiltersAttribute.cs#L25
Since this commit you are able to override the default behavior when authentication failed:
ServiceStackController.AuthorizationErrorResult
can be modified in the same way.Setting
HtmlRedirect
tonull
doesn't work in this case, because the behavior of the[Authenticate]
attribute (and all other ServiceStack attributes) is slightly different when used with ASP.net MVC controllers instead of ServiceStack services.