我正在实施owin中间件,我需要将会话存储在数据库中。 考虑这个例子 -
var options = new CookieAuthenticationOptions()
{
AuthenticationType = CookieAuthenticationDefaults.AuthenticationType,
CookieName = "ChatCookies",
LoginPath = CookieAuthenticationDefaults.LoginPath,
LogoutPath = CookieAuthenticationDefaults.LogoutPath,
ExpireTimeSpan = TimeSpan.FromDays(1),
SessionStore =
};
这里有会话存储选项,我想实现它,所以我无法弄清楚,怎么做。请帮帮我。
答案 0 :(得分:0)
您需要一个实现public class CustomAuthenticationSessionStore : IAuthenticationSessionStore {
// Your implementation depending on use case goes here.
public Task RemoveAsync(string key) {
throw new NotImplementedException();
}
public Task RenewAsync(string key, AuthenticationTicket ticket) {
throw new NotImplementedException();
}
public Task<AuthenticationTicket> RetrieveAsync(string key) {
throw new NotImplementedException();
}
public Task<string> StoreAsync(AuthenticationTicket ticket) {
throw new NotImplementedException();
}
}
var options = new CookieAuthenticationOptions() {
AuthenticationType = CookieAuthenticationDefaults.AuthenticationType,
CookieName = "ChatCookies",
LoginPath = CookieAuthenticationDefaults.LoginPath,
LogoutPath = CookieAuthenticationDefaults.LogoutPath,
ExpireTimeSpan = TimeSpan.FromDays(1),
SessionStore = new CustomAuthenticationSessionStore()
};
的类的实例。界面本身很简单:
var data = fs.readFileSync(String(oriPath.path))
Here's该接口实现的一个示例。然后,只需将您的实例传递给:
$(function() {
$('.wordDiv').click(function() {
var txt = $(this).find('ul').html();
$('#right-container').html('<ul>' + txt + '</ul>')
})
})