public async Task GeneratePasswordResetTokenTest() { var adminUser = await CreateRandomUser(true); var user = await CreateRandomUser(true); var newPassword = GetRandomPassword(); string token; { var client = new HttpClientAuthenticationHelper(_factory.CreateClient()); AddClaimToUser(adminUser.UserName, AuthenticationServiceClaims.GeneratePasswordResetTokenClaim); await client.Login(adminUser.UserName, adminUser.Password); token = (await client.GeneratePasswordResetToken(user.UserName)).Value; } { var client = new HttpClientAuthenticationHelper(_factory.CreateClient()); await client.ResetPassword(user.UserName, token, newPassword); Assert.IsTrue((await client.Login(user.UserName, newPassword)).Value); } }
public async Task CheckForClaimsTest() { var client = new HttpClientAuthenticationHelper(_factory.CreateClient()); var user = await CreateRandomUser(true); await client.Login(user.UserName, user.Password); ShouldReturnRequiresClaim(await client.SetPassword(user.UserName, "test", false), AuthenticationServiceClaims.SetPasswordClaim); AddClaimToUser(user.UserName, AuthenticationServiceClaims.SetPasswordClaim); ShouldReturnRequiresClaim(await client.SetPassword(user.UserName, "test", true), AuthenticationServiceClaims.IgnorePasswordStrengthPolicyClaim); ShouldReturnRequiresClaim(await client.UnlockUser(user.UserName), AuthenticationServiceClaims.UnlockUserClaim); ShouldReturnRequiresClaim(await client.GeneratePasswordResetToken(user.UserName), AuthenticationServiceClaims.GeneratePasswordResetTokenClaim); }