diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/ExternalLoginProviderBase.cs b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/ExternalLoginProviderBase.cs
index 631a1593d2..d1db82e254 100644
--- a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/ExternalLoginProviderBase.cs
+++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/ExternalLoginProviderBase.cs
@@ -13,21 +13,17 @@ namespace Volo.Abp.Identity.AspNetCore
protected IGuidGenerator GuidGenerator { get; }
protected ICurrentTenant CurrentTenant { get; }
protected IdentityUserManager UserManager { get; }
- protected RandomPasswordGenerator RandomPasswordGenerator { get; }
-
protected IIdentityUserRepository IdentityUserRepository { get; }
protected ExternalLoginProviderBase(
IGuidGenerator guidGenerator,
ICurrentTenant currentTenant,
IdentityUserManager userManager,
- RandomPasswordGenerator randomPasswordGenerator,
IIdentityUserRepository identityUserRepository)
{
GuidGenerator = guidGenerator;
CurrentTenant = currentTenant;
UserManager = userManager;
- RandomPasswordGenerator = randomPasswordGenerator;
IdentityUserRepository = identityUserRepository;
}
diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/RandomPasswordGenerator.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/RandomPasswordGenerator.cs
deleted file mode 100644
index 40643d8a76..0000000000
--- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/RandomPasswordGenerator.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using System;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Identity;
-using Microsoft.Extensions.Options;
-using Volo.Abp.DependencyInjection;
-
-namespace Volo.Abp.Identity
-{
- ///
- /// This class can be used to generate random password
- /// based on the rules defined in the .
- ///
- public class RandomPasswordGenerator : ITransientDependency
- {
- public const int MinPasswordLength = 32;
-
- protected IdentityOptions Options { get; }
- protected Random Random { get; }
-
- public RandomPasswordGenerator(IOptions options)
- {
- Options = options.Value;
- Random = new Random();
- }
-
- public virtual Task CreateAsync()
- {
- var nonAlphanumeric = Options.Password.RequireNonAlphanumeric;
- var digit = Options.Password.RequireDigit;
- var lowercase = Options.Password.RequireLowercase;
- var uppercase = Options.Password.RequireUppercase;
-
- var passwordBuilder = new StringBuilder();
-
- var length = Math.Max(Options.Password.RequiredLength, MinPasswordLength);
- while (passwordBuilder.Length < length)
- {
- var nextChar = (char)Random.Next(32, 126);
-
- passwordBuilder.Append(nextChar);
-
- if (char.IsDigit(nextChar))
- {
- digit = false;
- }
- else if (char.IsLower(nextChar))
- {
- lowercase = false;
- }
- else if (char.IsUpper(nextChar))
- {
- uppercase = false;
- }
- else if (!char.IsLetterOrDigit(nextChar))
- {
- nonAlphanumeric = false;
- }
- }
-
- if (nonAlphanumeric)
- {
- passwordBuilder.Append((char)Random.Next(33, 48));
- }
-
- if (digit)
- {
- passwordBuilder.Append((char)Random.Next(48, 58));
- }
-
- if (lowercase)
- {
- passwordBuilder.Append((char)Random.Next(97, 123));
- }
-
- if (uppercase)
- {
- passwordBuilder.Append((char)Random.Next(65, 91));
- }
-
- return Task.FromResult(passwordBuilder.ToString());
- }
- }
-}
diff --git a/modules/identity/test/Volo.Abp.Identity.AspNetCore.Tests/Volo/Abp/Identity/AspNetCore/FakeExternalLoginProvider.cs b/modules/identity/test/Volo.Abp.Identity.AspNetCore.Tests/Volo/Abp/Identity/AspNetCore/FakeExternalLoginProvider.cs
index 95eb3e6958..6a54ccf7e3 100644
--- a/modules/identity/test/Volo.Abp.Identity.AspNetCore.Tests/Volo/Abp/Identity/AspNetCore/FakeExternalLoginProvider.cs
+++ b/modules/identity/test/Volo.Abp.Identity.AspNetCore.Tests/Volo/Abp/Identity/AspNetCore/FakeExternalLoginProvider.cs
@@ -14,13 +14,11 @@ namespace Volo.Abp.Identity.AspNetCore
IGuidGenerator guidGenerator,
ICurrentTenant currentTenant,
IdentityUserManager userManager,
- RandomPasswordGenerator randomPasswordGenerator,
IIdentityUserRepository identityUserRepository)
: base(
guidGenerator,
currentTenant,
userManager,
- randomPasswordGenerator,
identityUserRepository)
{
diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RandomPasswordGenerator_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RandomPasswordGenerator_Tests.cs
deleted file mode 100644
index f28fed08d8..0000000000
--- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RandomPasswordGenerator_Tests.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Threading.Tasks;
-using Shouldly;
-using Xunit;
-
-namespace Volo.Abp.Identity
-{
- public class RandomPasswordGenerator_Tests : AbpIdentityDomainTestBase
- {
- private readonly RandomPasswordGenerator _randomPasswordGenerator;
-
- public RandomPasswordGenerator_Tests()
- {
- _randomPasswordGenerator = GetRequiredService();
- }
-
- [Fact]
- public async Task CreateAsync()
- {
- var password = await _randomPasswordGenerator.CreateAsync();
- password.Length.ShouldBeGreaterThanOrEqualTo(RandomPasswordGenerator.MinPasswordLength);
- }
- }
-}