【发布时间】:2013-10-03 13:38:55
【问题描述】:
我已经为使用 FubuMVC 的 Web 应用程序实现了 CurrentUserPropertyBinder(见下文)。
public class CurrentUserPropertyBinder : IPropertyBinder
{
private readonly Database _database;
private readonly ISecurityContext _security;
public CurrentUserPropertyBinder(Database database, ISecurityContext security)
{
_database = database;
_security = security;
}
public bool Matches(PropertyInfo property)
{
return property.PropertyType == typeof(User)
&& property.Name == "CurrentUser";
}
public void Bind(PropertyInfo property, IBindingContext context)
{
var currentUser = //check database passing the username to get further user details using _security.CurrentIdentity.Name
property.SetValue(context.Object, currentUser, null);
}
}
当我登录到我的网站时,一切正常。 CurrentUserPropertyBinder 包含执行任务所需的所有信息(即 _security.CurrentIdentity.Name 中包含正确的用户详细信息)
当我尝试使用打开标准 fileDialog 的 FineUploader (http://fineuploader.com/) 导入文件时,_security.CurrentIdentity.Name 为空。
它似乎不记得用户是谁,我不知道为什么。它适用于我的所有其他路线,但我导入了一个文件,它不会记住用户。
请帮忙!提前致谢
注意:我们使用 FubuMVC.Authentication 对用户进行身份验证
【问题讨论】:
-
您是否使用 FubuMVC.Authentication 或其他方式来验证您的用户?
-
我们正在使用 FubuMVC.Authentication 对用户进行身份验证
标签: fubumvc