Open Closed

AllowAnonymous Authorize For Authorize IIdentityUserAppService #450


User avatar
0
hungvt created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v3.1.2
  • UI type: Angular Hi team, I using IIdentityUserAppService to call function CreateAsync. How to AllowAnonymous Authorize for Authorize IIdentityUserAppService Thank

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Try:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IIdentityUserAppService))]
    public class MyIdentityUserAppService : IdentityUserAppService
    {
        public MyIdentityUserAppService(IdentityUserManager userManager, IIdentityUserRepository userRepository, IIdentityRoleRepository roleRepository) : base(userManager, userRepository, roleRepository)
        {
        }
    
        [AllowAnonymous]
        public override async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
        {
            var result = await base.CreateAsync(input);
    
            return result;
        }
    }
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11