本文整理汇总了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);
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}
}