有没有人使用membershipreboot.owin创建了一个自定义用户帐户的多租户示例?
在使用自定义帐户时,我很难弄清楚应该如何配置成员资格中间件。它不在默认示例的范围内。我想我对时髦的Funcs经验还不够。任何帮助都将不胜感激。
谢谢。
OwinExtentionMethods如下所示:
public static class MembershipRebootOwinExtensions
{
public static void UseMembershipReboot<TAccount>(
this IAppBuilder app,
Func<IDictionary<string, object>, UserAccountService<TAccount>> userAccountServiceFactory,
Func<IDictionary<string, object>, AuthenticationService<TAccount>> authenticationServiceFactory = null
)
where TAccount : UserAccount
{
app.Use<MembershipRebootMiddleware<TAccount>>(userAccountServiceFactory, authenticationServiceFactory);
app.UseMembershipReboot();
}
public static void UseMembershipReboot<TAccount>(
this IAppBuilder app,
CookieAuthenticationOptions cookieOptions,
Func<IDictionary<string, object>, UserAccountService<TAccount>> userAccountServiceFactory,
Func<IDictionary<string, object>, AuthenticationService<TAccount>> authenticationServiceFactory = null
)
where TAccount : UserAccount
{
app.Use<MembershipRebootMiddleware<TAccount>>(userAccountServiceFactory, authenticationServiceFactory);
app.UseMembershipReboot(cookieOptions);
}我该如何填写这两个函数呢?
Func<IDictionary<string, object>, UserAccountService<TAccount>>和
Func<IDictionary<string, object>, AuthenticationService<TAccount>> 发布于 2014-09-01 09:41:24
发布于 2015-10-29 13:23:26
只需将owin的当前上下文获取为
var owin = ctx.Resolve<IOwinContext>();然后将您的自定义用户帐户注册为
var owinAuth = new OwinAuthenticationService<CustomUserAccount>(AuthenticationTypes.Negotiate, ctx.Resolve<UserAccountService<CustomUserAccount>>(), owin.Environment);我希望现在还来得及。
https://stackoverflow.com/questions/25582315
复制相似问题