小编Dus*_*ton的帖子

IdentityFactoryOptions <AppIdentityUserManager>选项如何设置?

如果您使用过Identity 2.0,那么您已经看到了这段代码:

       public static AppIdentityUserManager Create(
            IdentityFactoryOptions<AppIdentityUserManager> options,
            IOwinContext context)
        {

          [snip]

           var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider =
                    new DataProtectorTokenProvider<AppIdentityUser>(
                        dataProtectionProvider.Create("ASP.NET Identity"));
            }
            return manager;
        }
Run Code Online (Sandbox Code Playgroud)

我明白那个.在我的应用程序中,options.DataProtectionProvider(显然作为参数传入)为null.该集合的方式和位置(或不是这样的情况?)我看过的每个地方都有完整的代码片段,但没有解释设置DataProtectionProvider.

编辑:我在Identity示例项目中读取了DataProtectionProvider,它解释了UserTokenProvider是什么,但没有解释它是如何在IdentityFactoryOptions对象中设置的.

c# asp.net-mvc asp.net-identity

13
推荐指数
1
解决办法
2202
查看次数

标签 统计

asp.net-identity ×1

asp.net-mvc ×1

c# ×1