예제 #1
0
 private void InsertClaims(M1User user)
 {
     foreach (var claim in user.Claims)
     {
         Insert.IntoTable("UserClaim").InSchema("Membership").Row(new
         {
             UserId = user.UserId,
             Type   = claim.Type,
             Value  = claim.Value
         });
     }
 }
예제 #2
0
 private void InsertClaims(M1User user)
 {
     foreach (var claim in user.Claims)
     {
         Insert.IntoTable("UserClaim").InSchema("Membership").Row(new
         {
             UserId = user.UserId,
             Type = claim.Type,
             Value = claim.Value
         });
     }
 }
예제 #3
0
 private void InsertProfile(M1User user)
 {
     if (user.Profile != null)
     {
         Insert.IntoTable("UserProfile").InSchema("Membership").Row(new
         {
             UserId               = user.UserId,
             FirstName            = new ExplicitUnicodeString(user.Profile.FirstName),
             LastName             = new ExplicitUnicodeString(user.Profile.LastName),
             Email                = user.Profile.Email,
             PhoneNumber          = user.Profile.PhoneNumber,
             SecretPhrase         = new ExplicitUnicodeString(user.Profile.SecretPhrase),
             PhoneNumberConfirmed = user.Profile.PhoneNumberConfirmed
         });
     }
 }
예제 #4
0
 private void InsertProfile(M1User user)
 {
     if (user.Profile != null)
     {
         Insert.IntoTable("UserProfile").InSchema("Membership").Row(new
         {
             UserId = user.UserId,
             FirstName = new ExplicitUnicodeString(user.Profile.FirstName),
             LastName = new ExplicitUnicodeString(user.Profile.LastName),
             Email = user.Profile.Email,
             PhoneNumber = user.Profile.PhoneNumber,
             SecretPhrase = new ExplicitUnicodeString(user.Profile.SecretPhrase),
             PhoneNumberConfirmed = user.Profile.PhoneNumberConfirmed
         });
     }
 }
예제 #5
0
        public override void Up()
        {
            var users = new List <M1User>()
            {
                M1User.Create("smolyakoff", DevPassword, "Admin", new M1Profile()
                {
                    Email                = "*****@*****.**",
                    FirstName            = "Константин",
                    LastName             = "Смоляков",
                    PhoneNumber          = "+375293593295",
                    PhoneNumberConfirmed = true
                }),
                M1User.Create("losik", DevPassword, "Admin"),
                M1User.Create("sherbetr", DevPassword, "Admin"),
                M1User.Create("jaymz", DevPassword, "Admin"),
                M1User.Create("gostop", DevPassword, "Admin"),
                M1User.Create("bradpitt", DevPassword, "Customer", new M1Profile()
                {
                    Email     = "*****@*****.**",
                    FirstName = "Брэд",
                    LastName  = "Питт"
                }),
                M1User.Create("terminator", DevPassword, "Customer",
                              new M1Profile()
                {
                    Email     = "*****@*****.**",
                    FirstName = "Арнольд",
                    LastName  = "Шварцнеггер"
                }),
                M1User.Create("meganfox", DevPassword, "Customer", new M1Profile()
                {
                    Email     = "*****@*****.**",
                    FirstName = "Меган",
                    LastName  = "Фокс"
                }),
            };

            users.ForEach(x =>
            {
                InsertUser(x);
                InsertClaims(x);
                InsertProfile(x);
            });
        }
예제 #6
0
파일: M1User.cs 프로젝트: al-main/vabank
 public static M1User Create(string login, string password, string role, M1Profile profile = null)
 {
     var user = new M1User
     {
         UserId = Guid.NewGuid(),
         UserName = login,
         Password = Password.Create(password),
         Claims = new List<Claim>
         {
             new Claim(ClaimTypes.Name, login),
             new Claim(ClaimTypes.Role, role)
         },
         Profile = profile
     };
     user.Claims.Add(new Claim(ClaimTypes.Sid, user.UserId.ToString()));
     var credentials = user.Claims.OrderBy(x => x.Type).Select(x => x.ToString());
     user.SecurityStamp = Hash.Compute(credentials);
     return user;
 }
예제 #7
0
        public static M1User Create(string login, string password, string role, M1Profile profile = null)
        {
            var user = new M1User
            {
                UserId   = Guid.NewGuid(),
                UserName = login,
                Password = Password.Create(password),
                Claims   = new List <Claim>
                {
                    new Claim(ClaimTypes.Name, login),
                    new Claim(ClaimTypes.Role, role)
                },
                Profile = profile
            };

            user.Claims.Add(new Claim(ClaimTypes.Sid, user.UserId.ToString()));
            var credentials = user.Claims.OrderBy(x => x.Type).Select(x => x.ToString());

            user.SecurityStamp = Hash.Compute(credentials);
            return(user);
        }
예제 #8
0
 private void InsertUser(M1User user)
 {
     Insert.IntoTable("User").InSchema("Membership").Row(user.ToTableRow());
 }
예제 #9
0
 private void InsertUser(M1User user)
 {
     Insert.IntoTable("User").InSchema("Membership").Row(user.ToTableRow());
 }