I am new to Nancy and am now experimenting with Auth. We look forward to the full implementation of forms authentication.
For testing purposes, I have 3 modules.
Another module:
public class OtherModule : NancyModule { public OtherModule() : base() { // Use global, module level authentication. this.RequiresAuthentication(); Get["/other"] = _ => { return "Other"; }; Get["/woot"] = _ => { return "Woot"; }; } }
The main module:
public class MainModule : NancyModule { public MainModule() : base() { Get["/yolo"] = _ => {
AuthModule:
public class AuthModule : NancyModule { public AuthModule() : base() { Get["/login"] = _ => { return "To proceed, you must authenticate. [show form]"; }; } }
Now, when I go to /other and / or /woot , I am redirected to /login - as expected. Although, when I go to /yolo , the application throws a Nancy.ErrorHandling.RouteExecutionEarlyExitException , where I suggested that it should redirect me to /login?returnUrl=seeme .
I went through the github form auth source , which describes the behavior of this file . I cannot find significant differences (my Bootstrapper , my IUserMapper , my IUserIdentity ).
Am I using wrong here? Should I try / catch it and prepare the answers accordingly? This is mistake?
I run NancyFX in a self-service environment ( Nancy.Hosting.Self ), without ASP and without OWIN.
authentication c # nancy
jolt
source share