Activities of "bhyatz"

Answer

I am using identity server and the ui is angular.

I have currently implemented this by extending the Volo.Abp.Identity.IdentityUser and updating GetRolesAsync,IsInRoleAsync and GetActiveRoles to filter only the active roles. I am not sure if this is the best way or not.

Answer

Hi

I am getting the following error, I have tried the above and it is still not working. I only develop on one computer.

Answer

According to https://github.com/abpframework/abp/issues/1082 this has been added to backlog with priority high, do you have an idea when this would be implemented?

Answer

Hi Alper

We are using the angular ui , not mvc. How would you do this on the angular ui?

Answer

I am not sure if this is the correct way. I created my own IResourceOwnerPasswordValidator that extends AbpResourceOwnerPasswordValidator. I modified ValidateAsync to include my own rules and than called await base.ValidateAsync(context);

public override async Task ValidateAsync(ResourceOwnerPasswordValidationContext context)
        {
            await ReplaceEmailToUsernameOfInputIfNeeds(context).ConfigureAwait(false);

            var user = _abUserManager.GetUser(context.UserName);
            if (user != null)
            {
                var now = DateTime.Now;

                if (user.ValidFromDate.CompareTo(now) > 0 || user.ValidToInclDate.AddDays(1).CompareTo(now) < 0)
                {
                    _logger.LogInformation("User not in valid from and valid to dates : {username}", context.UserName);
                    await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "login not valid for dates", interactive: false)).ConfigureAwait(false);
                    context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant,"User Login not valid for current Date");
                }
                else if(!user.Active)
                {
                    _logger.LogInformation("User is deactivated : {username}", context.UserName);
                    await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "is deactivated", interactive: false)).ConfigureAwait(false);
                    context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, "User is deactivated");
                }
                else
                {
                    await base.ValidateAsync(context);
                }
            }
            else
            {
                _logger.LogInformation("No user found matching username: {username}", context.UserName);
                await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid username", interactive: false)).ConfigureAwait(false);
                context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant);
            }
        }

I also createe my own service to add users with the extra properties. I first create the user using the injected IAbUserManager and then update the user using the custom user respository

public override async Task<AbUserDto> CreateAsync(AbUserCreateDto input)
        {
            var user = _abUserManager.GetUser(input.Username);

            if (user != null)
            {
                throw new BusinessException(AumErrorCodes.UserNameExists);
            }

            await ValidateInput(input.PhoneNumbers,input.PersonTypeId,input.CompanyId);
            var emailAddress = input.EmailAddresses.First().EmailAddress;

            var userId  = await _abUserManager.CreateUserAsync(input.Username, input.Password, emailAddress,
            input.ValidFromDate, input.ValidToInclDate, input.Active, input.DeactivationReason);

            input.AbpUserId = userId;

            return await base.CreateAsync(input);
        }
Answer

Angular

Showing 11 to 16 of 16 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on October 30, 2025, 06:33