当前位置: 首页>>代码示例>>C#>>正文


C# IOwinContext.GetUserManager方法代码示例

本文整理汇总了C#中IOwinContext.GetUserManager方法的典型用法代码示例。如果您正苦于以下问题:C# IOwinContext.GetUserManager方法的具体用法?C# IOwinContext.GetUserManager怎么用?C# IOwinContext.GetUserManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOwinContext的用法示例。


在下文中一共展示了IOwinContext.GetUserManager方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AuthenticationRepository

 public AuthenticationRepository(IOwinContext owinContext)
 {
     userManager = owinContext.GetUserManager<ApplicationUserManager>();
     roleManager = owinContext.Get<ApplicationRoleManager>();
     authenticationManager = owinContext.Authentication;
     request = owinContext.Request;
 }
开发者ID:CuongDuongDuy,项目名称:SecuredToDoList,代码行数:7,代码来源:AuthenticationRepository.cs

示例2: CreateApplicationSignInManager

 public static ApplicationSignInManager CreateApplicationSignInManager(
     IdentityFactoryOptions<ApplicationSignInManager> options,
     IOwinContext context)
 {
     return
         new ApplicationSignInManager(
             context.GetUserManager<ApplicationUserManager>(),
             context.Authentication);
 }
开发者ID:Neilski,项目名称:URF-Identity,代码行数:9,代码来源:Startup.ConfigureAuth.cs

示例3: GetIdentityByUserIdAsync

        public async Task<ClaimsIdentity> GetIdentityByUserIdAsync(IOwinContext context, string authenticationType, string userId)
        {
            ClaimsIdentity identity = null;

            var userManager = context.GetUserManager<ApplicationUserManager>();
            if (userManager != null)
            {
                var user = await userManager.FindByIdAsync(userId);
                if (user != null)
                {
                    identity = await userManager.CreateIdentityAsync(user, authenticationType);
                }
            }

            return identity;
        }
开发者ID:adwardliu,项目名称:vc-community,代码行数:16,代码来源:ApplicationClaimsIdentityProvider.cs

示例4: Create

 public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context)
 {
     CommonTools._signInManager= new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication);
     // return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication);
     return (BlackOwl.Core.Application.ApplicationSignInManager)CommonTools._signInManager;
 }
开发者ID:angaratosurion,项目名称:BlackOwl,代码行数:6,代码来源:IdentityConfig.cs

示例5: CreateSignInManager

 private static SignInManager<ApplicationUser, string> CreateSignInManager(IdentityFactoryOptions<SignInManager<ApplicationUser, string>> options, IOwinContext context)
 {
     return new SignInManager<ApplicationUser, string>(context.GetUserManager<UserManager<ApplicationUser>>(), context.Authentication);
 }
开发者ID:Azure-Architecture-Workshop,项目名称:contososports,代码行数:4,代码来源:Startup.Auth.cs

示例6: UserService

 public UserService(IOwinContext context)
 {
     _userManager = context.GetUserManager<UserManager<User,int>>();
     _signinManager = context.Get<SignInManager<User, int>>();
     _authManager = context.Authentication;
 }
开发者ID:stoneflyop1,项目名称:AspNetIdentity-Owin,代码行数:6,代码来源:IUserService.cs

示例7: GetUserByClientAuthorization

 private async Task<Tuple<ApplicationUser, string>> GetUserByClientAuthorization(IOwinContext context, string clientAuthorization, string clientRequestUri, string clientRequestMethod, string clientHostName, string clientHostAddress)
 {
     Tuple<ApplicationUser, string> result = null;
     string[] autherizationHeaderArray = ClientApiProvider.GetAutherizationHeaderValues(clientAuthorization);
     if (autherizationHeaderArray != null)
     {
        // Log.Logger.Debug("DuongDQ4");
         string apiKey = autherizationHeaderArray[0];
         string incomingSignatureHash = autherizationHeaderArray[1];
         string nonce = autherizationHeaderArray[2];
         string requestTimeStamp = autherizationHeaderArray[3];
         var userBll = UnityConfig.GetConfiguredContainer().Resolve<IUserBll>();
         UserApp userApp = await userBll.GetUserApp(apiKey);
         if (userApp != null && !string.IsNullOrEmpty(userApp.ApiSecret))
         {
            // Log.Logger.Debug("DuongDQ5: Get user app ok");
             if (CheckClientHost(userApp.AppHosts, userApp.AppIps, clientHostName, clientHostAddress))
             {
                // Log.Logger.Debug("DuongDQ6: check host ok");
                 bool isValid;
                 try
                 {
                     isValid = ClientApiProvider.isValidRequest(clientRequestUri, clientRequestMethod, userApp.ApiKey, userApp.ApiSecret, incomingSignatureHash, nonce, requestTimeStamp);
                 }
                 catch
                 {
                     isValid = false;
                 }
                 if (isValid)
                 {
                    // Log.Logger.Debug("DuongDQ7: Valid request");
                     var userManager = context.GetUserManager<ApplicationUserManager>();
                     ApplicationUser user = await userManager.FindByIdAsync(userApp.UserId);
                     if (user != null)
                     {
                         //Log.Logger.Debug(string.Format("{0}: Find user ok", (object)clientHostAddress));
                         result = new Tuple<ApplicationUser, string>(user, userApp.ApiSecret);
                     }
                     else
                         Log.Logger.Debug(string.Format("{0}: Not found user", clientHostAddress));
                 }
                 else
                     Log.Logger.Debug(string.Format("{0}: Invalid request", clientHostAddress));
             }
         }
         else
             Log.Logger.Debug(string.Format("{0}: Invalid api key", clientHostAddress));
     }
     return result;
 }
开发者ID:quangnc0503h,项目名称:ecommerce,代码行数:50,代码来源:ApplicationOAuthProvider.cs


注:本文中的IOwinContext.GetUserManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。