Activities of "EngincanV"

[Dependency(ReplaceServices = true)] 
[ExposeServices(typeof(AbpSignInManager), typeof(SignInManager<IdentityUser>))] 
public class LitmusSiginManager : AbpSignInManager 
{ 
    private readonly IRepository<AppUser, Guid> _appUserRepository; 
 
    public LitmusSiginManager(IdentityUserManager userManager, 
        IHttpContextAccessor contextAccessor, 
        IUserClaimsPrincipalFactory<Volo.Abp.Identity.IdentityUser> claimsFactory, 
        IOptions<IdentityOptions> optionsAccessor, 
        ILogger<SignInManager<Volo.Abp.Identity.IdentityUser>> logger, 
        IAuthenticationSchemeProvider schemes, 
        IUserConfirmation<Volo.Abp.Identity.IdentityUser> confirmation, 
        IOptions<AbpIdentityOptions> options, 
        IRepository<AppUser, Guid> appUserRepository 
        ) : base(userManager, 
            contextAccessor, 
            claimsFactory, 
            optionsAccessor, 
            logger, 
            schemes, 
            confirmation, 
            options) 
    { 
        _appUserRepository = appUserRepository; 
    } 
 
    public override async Task<SignInResult> PasswordSignInAsync(Volo.Abp.Identity.IdentityUser user, string password, bool isPersistent, bool lockoutOnFailure) 
    { 
        var appUser = await _appUserRepository.FirstOrDefaultAsync(x => x.Id == user.Id); 
 
        if (appUser != null) 
        { 
            if (appUser.Status == AbpUserStatusEnum.InActive) 
                throw new AbpAuthorizationException("User is in InActive state."); 
        } 
 
        return base.PasswordSignInAsync(user, password, isPersistent, lockoutOnFailure).Result; 
    } 
} 

IdentityServerModule :

public class LitmusIdentityServerModule : AbpModule 
{ 
    public override void PreConfigureServices(ServiceConfigurationContext context) 
    { 
        PreConfigure<IdentityBuilder>(identityBuilder => 
        { 
            identityBuilder.AddSignInManager<LitmusSiginManager>(); 
        }); 
    } 
} 

Can you move the related changes to your separated identity module? And also can you check the IdentityUser's namespace? It is important to use Volo.Abp.Identity.IdentityUser type for SignInManager.

Can you also expose SignInManager<IdentityUser> as below?

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AbpSignInManager), typeof(SignInManager<IdentityUser>))]
public class LitmusSiginManager : AbpSignInManager 
{
    public override Task<SignInResult> PasswordSignInAsync(string userName, string password, bool isPersistent, bool lockoutOnFailure)
    {
        //your logic
        return base.PasswordSignInAsync(userName, password, isPersistent, lockoutOnFailure);
    }

    public override Task<SignInResult> PasswordSignInAsync(IdentityUser user, string password, bool isPersistent, bool lockoutOnFailure)
    {
        //your logic
        return base.PasswordSignInAsync(user, password, isPersistent, lockoutOnFailure);
    }
}

Do you use separated identity server? If you use, you can add the .IdentityServer project's reference to the project (SCV.Litmus.LitmusIdentity)

Don't forget to add DependsOn.

You're welcome.

It seems your ABP Commercial NuGet Source added with wrong url. (it should be nuget.abp.io not nugut.abp.io)

Please run the dotnet nuget remove source "ABP Commercial NuGet Source" on your terminal and then run the following command dotnet tool install -g Volo.Abp.Suite --add-source https://nuget.abp.io/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/v3/index.json --version 4.4.2.

change the xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx part with your api-key

I run this command but show error Please if u need Key let me know

In here, there is a nuget source named "nugut.abp.io" (and it is not found i guess). If it's not used can you delete it?

dotnet nuget remove source <source_name>

You can see the source_name by running dotnet nuget list source command.

You can inherit from AbpSignInManager and override the PasswordSignInAsync method.

https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services#overriding-a-service-class

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AbpSignInManager))]
public class MyCustomSignInManager : AbpSignInManager 
{
    public async override Task<SignInResult> PasswordSignInAsync(string userName, string password,
        bool isPersistent, bool lockoutOnFailure)
    {
        //your logic
    }
}

When you run dotnet nuget list source command, is nuget.org on top?

https://support.abp.io/QA/Questions/414/ABP-Suite-install-problem#answer-a69dadf8-946b-01e4-d63f-39f78fb3375e

You can examine this document to see how you can create a CustomSigninManager.

And after you've created CustomSigninManager, you can override the SignInAsync method and implement your logic.

Don't forget to register your CustomSigninManager => https://docs.abp.io/en/abp/2.9/How-To/Customize-SignIn-Manager#register-to-dependency-injection

Can you also specify the version (--version 4.4.2) like below?

dotnet tool install -g Volo.Abp.Suite --add-source https://nuget.abp.io/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/v3/index.json --version 4.4.2
Showing 661 to 670 of 714 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 05:21