Ejemplo n.º 1
0
        public static IdentityUser UserWithLogin()
        {
            var user = new IdentityUser();
            user.AddLogin(new UserLoginInfo("test", "testing"));

            return user;
        }
Ejemplo n.º 2
0
        public static IdentityUser UserWithLogin()
        {
            var user = new IdentityUser();

            user.AddLogin(new UserLoginInfo("test", "testing"));

            return(user);
        }
Ejemplo n.º 3
0
    private async Task AddUsers()
    {
        var adminUser = new IdentityUser(_guidGenerator.Create(), "administrator", "*****@*****.**");

        adminUser.AddRole(_adminRole.Id);
        adminUser.AddClaim(_guidGenerator, new Claim("TestClaimType", "42"));
        await _userRepository.InsertAsync(adminUser);

        var john = new IdentityUser(_testData.UserJohnId, "john.nash", "*****@*****.**");

        john.AddRole(_moderatorRole.Id);
        john.AddRole(_supporterRole.Id);
        john.AddOrganizationUnit(_ou111.Id);
        john.AddOrganizationUnit(_ou112.Id);
        john.AddLogin(new UserLoginInfo("github", "john", "John Nash"));
        john.AddLogin(new UserLoginInfo("twitter", "johnx", "John Nash"));
        john.AddClaim(_guidGenerator, new Claim("TestClaimType", "42"));
        john.SetToken("test-provider", "test-name", "test-value");
        await _userRepository.InsertAsync(john);

        var david = new IdentityUser(_testData.UserDavidId, "david", "*****@*****.**");

        david.AddOrganizationUnit(_ou112.Id);
        await _userRepository.InsertAsync(david);

        var neo = new IdentityUser(_testData.UserNeoId, "neo", "*****@*****.**");

        neo.AddRole(_supporterRole.Id);
        neo.AddClaim(_guidGenerator, new Claim("TestClaimType", "43"));
        neo.AddOrganizationUnit(_ou111.Id);
        await _userRepository.InsertAsync(neo);

        var bob = new IdentityUser(_testData.UserBobId, "bob", "*****@*****.**");

        bob.SetIsActive(false);
        await _userManager.CreateAsync(bob, "1q2w3E*");
    }
 public UserStoreTests(MongoHelper mongoHelper)
 {
     testUser = new IdentityUser
     {
         Id              = Guid.NewGuid().ToString(),
         Name            = "name",
         NormalizedName  = "normalizedName",
         PasswordHash    = "hashypash",
         Email           = "*****@*****.**",
         NormalizedEmail = "*****@*****.**",
         EmailConfirmed  = true,
         SecurityStamp   = "stampy",
         LockoutEndDate  = new DateTimeOffset(DateTime.Now),
         PhoneNumber     = "222222222222"
     };
     testUser.AddLogin(new PersistedUserLoginInfo("gwar", "123"));
     testUser.AddClaim(new PersistedClaim("test", "data"));
     testUser.SetToken(new AuthToken("goog.goo", "garbage", "data"));
     testUser.AddToRole("blarg");
     db = mongoHelper.Database;
     usersCollection = mongoHelper.Users;
     userStore       = new MongoUserStore <IdentityUser>(usersCollection);
 }