我有一个模块旨在使管理员能够管理用户。当然,这个模块不仅需要认证,还需要特定的声明。我发现,如果您遗漏了相关索赔,您实际上只会得到一个空白页作为对您请求的响应。这并不理想。
我该如何改变呢?
下面的模块代码(如果有人需要看)...
public class UserModule : NancyModule
{
public UserModule()
: base("/users")
{
this.RequiresAnyClaim(new[] { "evil-dictator" });
Get["/"] = _ =>
{
ViewBag.UserName = Context.CurrentUser.UserName;
return Negotiate.WithView("Index");
};
// Generate an invitation for a pre-approved user
Get["/invite"] = _ =>
{
throw new NotImplementedException();
};
}
}