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


C# IUserAuthRepository.CreateUserAuth方法代码示例

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


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

示例1: CreateUser

        private void CreateUser(IUserAuthRepository userRep, int id, string userName, string email, string password, List<string> roles = null, List<string> permissions = null)
        {
            string hash;
            string salt;
            new SaltedHash().GetHashAndSaltString(password, out hash, out salt);

            userRep.CreateUserAuth(new UserAuth {
            Id = id,
            DisplayName = "DisplayName",
            Email = email,
            UserName = userName,
            FirstName = "FirstName",
            LastName = "LastName",
            PasswordHash = hash,
            Salt = salt,
            Roles = roles,
            Permissions = permissions
            }, password);
        }
开发者ID:TIHan,项目名称:MonoWeb,代码行数:19,代码来源:App.cs

示例2: CreateUser

        private static void CreateUser(IUserAuthRepository repository, int id, string username, string displayName, string email, string password)
        {
            string hash;
            string salt;
            new SaltedHash().GetHashAndSaltString(password, out hash, out salt);

            repository.CreateUserAuth(new UserAuth
            {
                Id = id,
                DisplayName = displayName,
                Email = email ?? "[email protected]{0}.com".Fmt(id),
                UserName = username,
                FirstName = "FirstName",
                LastName = "LastName",
                PasswordHash = hash,
                Salt = salt,
            }, password);
        }
开发者ID:jbijlsma,项目名称:LLBLGenPro_SS_Api_Razor_Templates,代码行数:18,代码来源:TestAppHost.cs

示例3: AddUser

        private static void AddUser(IUserAuthRepository userRepository)
        {
            //Add a user for testing purposes
            string hash;
            string salt;
            new SaltedHash().GetHashAndSaltString("test", out hash, out salt);

            userRepository.CreateUserAuth(
                new UserAuth
                    {
                        Id = 1,
                        DisplayName = "DisplayName",
                        Email = "[email protected]",
                        UserName = "test",
                        FirstName = "FirstName",
                        LastName = "LastName",
                        PasswordHash = hash,
                        Salt = salt,
                    },
                "test");
        }
开发者ID:MarcinKowal,项目名称:SmartDom,代码行数:21,代码来源:AppHost.cs

示例4: CreateUser

 private static void CreateUser(IUserAuthRepository userRepo, IUserAuth user, string password)
 {
     string hash;
     string salt;
     new SaltedHash().GetHashAndSaltString(password, out hash, out salt);
     user.Salt = salt;
     user.PasswordHash = hash;
     userRepo.CreateUserAuth(user, password);
 }
开发者ID:ryandavidhartman,项目名称:Auth404,代码行数:9,代码来源:DataBaseHelper.cs

示例5: SeedUsers

        private static void SeedUsers(IUserAuthRepository users)
        {
            //check to see if user exists
            if (users.GetUserAuthByUserName("admin.user") == null)
            {
                //create user
                const string pwd = "password";
                string hash, salt;
                new SaltedHash().GetHashAndSaltString(pwd, out hash, out salt);
                users.CreateUserAuth(new UserAuth
                    {
                        Id = 1,
                        DisplayName = "Admin User",
                        Email = "[email protected]",
                        UserName = "admin.user",
                        FirstName = "Admin",
                        LastName = "User",
                        PasswordHash = hash,
                        Salt = salt,
                        Roles = new List<string> {RoleNames.Admin},
                        Permissions = new List<string> {"God"}
                    }, pwd);
            }

            //check to see if user exists
            if (users.GetUserAuthByUserName("joe.budget") == null)
            {
                //create user
                const string pwd = "password";
                string hash, salt;
                new SaltedHash().GetHashAndSaltString(pwd, out hash, out salt);
                users.CreateUserAuth(new UserAuth
                    {
                        Id = 1,
                        DisplayName = "Joe BudgetHolder",
                        Email = "[email protected]",
                        UserName = "joe.budget",
                        FirstName = "Joe",
                        LastName = "BudgetHolder",
                        PasswordHash = hash,
                        Salt = salt,
                        Roles = new List<string> {"BudgetUser"},
                        Permissions = new List<string> {"GiveAward"}
                    }, pwd);
            }

            //check to see if user exists
            if (users.GetUserAuthByUserName("jane.employee") == null)
            {
                //create user
                const string pwd = "password";
                string hash, salt;
                new SaltedHash().GetHashAndSaltString(pwd, out hash, out salt);
                users.CreateUserAuth(new UserAuth
                    {
                        Id = 1,
                        DisplayName = "Jane Employee",
                        Email = "[email protected]",
                        UserName = "jane.employee",
                        FirstName = "Jane",
                        LastName = "Employee",
                        PasswordHash = hash,
                        Salt = salt,
                    }, pwd);
            }
        }
开发者ID:arron-green,项目名称:ServiceStack.Example,代码行数:66,代码来源:AppHost.cs


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