1

有没有人使用 membersreboot.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>> 
4

2 回答 2

0

自定义用户帐户示例有一个使用泛型的示例:

https://github.com/brockallen/BrockAllen.MembershipReboot/tree/master/samples/CustomUserAccount

于 2014-09-01T01:41:23.857 回答
0

只需将 owin 的当前上下文获取为

var owin = ctx.Resolve<IOwinContext>();

然后将您的自定义用户帐户注册为

var owinAuth = new OwinAuthenticationService<CustomUserAccount>(AuthenticationTypes.Negotiate, ctx.Resolve<UserAccountService<CustomUserAccount>>(), owin.Environment);

我希望现在还不算晚。

于 2015-10-29T05:23:26.417 回答