Activities of "maria_ruiz"

Question
  • ABP Framework version: v9.0.4
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi, We have recently implemented the PWA and I think we have a bit of a problem.

I have been reading the documentation: https://abp.io/docs/latest/framework/ui/blazor/pwa-configuration

We use the service-workers that come by default in the ABP template,

We have updated a few versions of nugets in the application and accessed the published application, The problem is that when we accessed the web through the Chrome browser, the changes of the new versions were not applied, it seemed that they were using a previous version because it did not work as expected, correcting an error,

This is stated in your documentation:

"The service-worker.published.js file, which is used after the app is published. Caches certain file extensions and supports offline scenarios by default (uses a cache-first strategy). A user must first visit the app while they're online. The browser automatically downloads and caches all of the resources required to operate offline and then when the network connection is disconnected, it can be used like before."

In the Chrome browser I had to clear the cache so that it would detect the new changes, Can it be related to having the PWA?

It works, thanks a lot

  • ABP Framework version: v9.0.4
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi, we have a problem override AbpExceptionFilter.

We have this class override the methods

In the host module, replace the services, for the class DefaultExceptionToErrorInfoConverter it works

in application initialization we added this code to verified if replace the class, returns SmcExceptionFilter

And in program host class also debugging and check

But when the exception is triggered, the debugging point stops in the class of AbpExceptionFilter

Any points to check why this might happen?

Okay, Can you tell me if you know approximately how much the new release will generate?

  • ABP Framework version: v9.0.4
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no

Good morning,

Please update the dependencies to entityframework with the latest versions, We have to have the same version in order not to have conflicts between references, Things break in this version,

For example expressions in dateonly

DateOnly.FromDateTime(from ?? DateTime.MinValue)

Is the same problem that this https://abp.io/support/questions/8887/SSO-Users-forced-to-add-password-VoloAccountPro-900

Sorry,

We don't have this code, I've explained myself wrong, and without that piece of code it still fails us.

Good morning,

we have reviewed the class,

in this class, what we are doing is commenting on the part where we ask for the password change.

In our case we have not added that, it suddenly appeared in the login to change the password.

using System; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using Fundanet.Core.Extensions; using Fundanet.Core.Infrastructure.Abstractions.AzureAd; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using OpenIddict.Abstractions; using Owl.reCAPTCHA; using Volo.Abp.Account.ExternalProviders; using Volo.Abp.Account.Public.Web; using Volo.Abp.Account.Public.Web.Pages.Account; using Volo.Abp.Account.Security.Recaptcha; using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.Caching; using Volo.Abp.DependencyInjection; using Volo.Abp.MultiTenancy; using Volo.Abp.Security.Claims; using IdentityUser = Volo.Abp.Identity.IdentityUser;

namespace Semicrol.Arco.Core.HttpApi.Host.Auth;

[ExposeServices(typeof(ArcoLoginModel), typeof(LoginModel))] public class ArcoLoginModel : LoginModel { private const string IsHostSessionKey = "isHostSession";

private readonly ITenantStore _tenantStore;

private readonly IDistributedCache<IsHostCacheItem> _cache;

private readonly IAzureAdManager _azureAdManager;

public bool HasB2CConfiguration { get; set; }

[BindProperty(SupportsGet = true)] public string TenancyName { get; set; }

[BindProperty(SupportsGet = true)]
[HiddenInput]
public bool ShowTenantSelector { get; set; }

protected AbpAspNetCoreMultiTenancyOptions Options { get; }

public ArcoLoginModel(
    IAuthenticationSchemeProvider schemeProvider,
    IOptions<AbpAccountOptions> accountOptions,
    IAbpRecaptchaValidatorFactory recaptchaValidatorFactory,
    IAccountExternalProviderAppService accountExternalProviderAppService,
    ICurrentPrincipalAccessor currentPrincipalAccessor,
    IOptions<Microsoft.AspNetCore.Identity.IdentityOptions> identityOptions,
    IOptionsSnapshot<reCAPTCHAOptions> reCaptchaOptions,
    ITenantStore tenantStore,
    ICurrentTenantAccessor currentTenantAccessor,
    IDistributedCache<IsHostCacheItem> cache,
    IOptions<AbpAspNetCoreMultiTenancyOptions> options,
    IAzureAdManager azureAdManager) : base(
    schemeProvider,
    accountOptions,
    recaptchaValidatorFactory,
    accountExternalProviderAppService,
    currentPrincipalAccessor,
    identityOptions,
    reCaptchaOptions)
{
    _tenantStore = tenantStore;
    _cache = cache;
    _azureAdManager = azureAdManager;
    HasB2CConfiguration = _azureAdManager.HasB2CConfiguration();
    Options = options.Value;
}

public override async Task<IActionResult> OnGetAsync()
{
    await GetShowTenantSelector();
    TenancyName = await HostSessionIsActive() ? "host" : CurrentTenant?.Name;
    var result = await base.OnGetAsync();

    if (LoginInput != null)
    {
        LoginInput.RememberMe = true;
    }

    return result;
}

public override async Task<IActionResult> OnPostAsync(string action)
{
    if (LoginInput != null)
    {
        LoginInput.RememberMe = true;
    }
    

    if (action is "ChangeTenant")
    {
        if (TenancyName == null)
        {
            return await OnGetAsync();
        }

        var changeTenantResult = await ChangeTenantAsync();
        var externalProviders = await GetExternalProviders();
        var visibleExternalProviders =
            externalProviders.Where(x => !string.IsNullOrWhiteSpace(x.DisplayName)).ToList();
        if (changeTenantResult && visibleExternalProviders.Count == 1)
        {
            return await OnPostExternalLogin(visibleExternalProviders.First().AuthenticationScheme);
        }
        else
        {
            return await base.OnGetAsync();
        }
    }

    if (action is "ResetTenant")
    {
        await _cache.RemoveAsync(IsHostSessionKey);
        CurrentTenant.Change(null);
        AbpMultiTenancyCookieHelper.SetTenantCookie(HttpContext, null, Options.TenantKey);
        TenancyName = null;
        return await OnGetAsync();
    }

    TenancyName = await HostSessionIsActive() ? "host" : CurrentTenant?.Name;
    if (!ModelState.IsValid)
    {
        return await base.OnGetAsync();
    }
    return await base.OnPostAsync(action);
}

public override async Task<IActionResult> OnGetExternalLoginCallbackAsync(string remoteError = null)
{
    var tenancyName = await HostSessionIsActive() ? "host" : CurrentTenant?.Name;

    if (remoteError != null)
    {
        Logger.LogWarning($"External login callback error: {remoteError}");
        return RedirectToPage("./Login");
    }

    await IdentityOptions.SetAsync();

    var loginInfo = await SignInManager.GetExternalLoginInfoAsync();
    if (loginInfo == null)
    {
        Logger.LogWarning("External login info is not available");
        return RedirectToPage("./Login");
    }

    var emailAddress = loginInfo.Principal.FindFirstValue(ClaimTypes.Email) ??
                       loginInfo.Principal.FindFirstValue(AbpClaimTypes.Email);

    if (string.IsNullOrEmpty(emailAddress))
    {
        emailAddress = loginInfo.Principal.FindFirstValue("preferred_username");
    }

    var emailFromClaimTypes = loginInfo.Principal.FindFirstValue(AbpClaimTypes.Email);

    if (string.IsNullOrEmpty(emailFromClaimTypes) && string.IsNullOrEmpty(emailAddress) == false)
    {
        loginInfo.Principal.AddClaim(AbpClaimTypes.Email, emailAddress);
    }

    var tenant = tenancyName ?? "host";

    var b2CUser = await _azureAdManager.User(tenant, emailAddress);

    if ((b2CUser?.CompanyName?.Split("|").TrimAll().ToLower().Contains(tenant.Trim().ToLower()) ?? false) == false)
    {
        await SignInManager.SignOutAsync();
        return RedirectToPage("./AccessDenied");
    }

    var user = await UserManager.FindByEmailAsync(emailAddress);
    if (user == null)
    {
        var externalLoginInfo = await SignInManager.GetExternalLoginInfoAsync();
        if (externalLoginInfo == null)
        {
            Logger.LogWarning("External login info is not available");
            return RedirectToPage("./Login");
        }

        await RegisterExternalUserAsync(externalLoginInfo, b2CUser, emailAddress, loginInfo.LoginProvider);
    }

    return await base.OnGetExternalLoginCallbackAsync(remoteError);
}

protected virtual async Task RegisterExternalUserAsync(ExternalLoginInfo externalLoginInfo, UserModel userModel,
    string emailAddress, string externalLoginAuthSchema)
{
    await IdentityOptions.SetAsync();

    var userName = emailAddress;
    var user = new IdentityUser(GuidGenerator.Create(), userName, emailAddress, CurrentTenant.Id)
    {
        Name = userModel?.Name,
        Surname = userModel?.Surname
    };

    (await UserManager.CreateAsync(user)).CheckErrors();
    (await UserManager.AddDefaultRolesAsync(user)).CheckErrors();

    var userLoginAlreadyExists = user.Logins.Any(x =>
        x.TenantId == user.TenantId &&
        x.LoginProvider == externalLoginInfo.LoginProvider &&
        x.ProviderKey == externalLoginInfo.ProviderKey);

    if (!userLoginAlreadyExists)
    {
        (await UserManager.AddLoginAsync(user, new UserLoginInfo(
            externalLoginInfo.LoginProvider,
            externalLoginInfo.ProviderKey,
            externalLoginInfo.ProviderDisplayName
        ))).CheckErrors();
    }

    await SignInManager.SignInAsync(user, isPersistent: true, externalLoginAuthSchema);

    // Clear the dynamic claims cache.
    await IdentityDynamicClaimsPrincipalContributorCache.ClearAsync(user.Id, user.TenantId);
}

private async Task<bool> ChangeTenantAsync()
{
    var isHostSession = TenancyName?.ToLower().Equals("host") ?? false;
    await SetCacheValue(isHostSession);

    if (isHostSession)
    {
        CurrentTenant.Change(null);
        return true;
    }

    TenantConfiguration tenant = null;
    if (string.IsNullOrEmpty(TenancyName) == false)
    {
        tenant = await _tenantStore.FindAsync(TenancyName);
        if (tenant == null)
        {
            Alerts.Danger(L["Arco:GivenTenantDoesNotExist"].Value);
            return false;
        }

        if (!tenant.IsActive)
        {
            Alerts.Danger(L["Arco:GivenTenantIsNotAvailable"].Value);
            return false;
        }
    }

    CurrentTenant.Change(tenant?.Id, tenant?.Name);

    await CurrentUnitOfWork.SaveChangesAsync();
    AbpMultiTenancyCookieHelper.SetTenantCookie(HttpContext, tenant?.Id, Options.TenantKey);

    return true;
}

private async Task SetCacheValue(bool isHostSession)
{
    await _cache.RemoveAsync(IsHostSessionKey);
    await _cache.SetAsync(IsHostSessionKey,
        new IsHostCacheItem()
        {
            IsHostSession = isHostSession
        },
        new DistributedCacheEntryOptions
        {
            AbsoluteExpiration = DateTimeOffset.Now.AddYears(10)
        });
}

private async Task<bool> HostSessionIsActive()
{
    var cacheResult = await _cache.GetAsync(IsHostSessionKey);
    return cacheResult?.IsHostSession ?? false;
}

private async Task GetShowTenantSelector()
{
    if (await HostSessionIsActive())
    {
        ShowTenantSelector = false;
    }
    else
    {
        ShowTenantSelector = CurrentTenant?.Id.HasValue == false;
    }
}

}

  • ABP Framework version: v9.0.4
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no

Good afternoon,

I need you to indicate me the changes to make that you indicated in this thread, we have the same problem, it forces to change the password,

the resource indicates that it is no longer available and I can not see the solution.

https://abp.io/support/questions/8722/External-user-being-prompted-to-generate-local-password-after-upgrading-to-ABP-9

Hi, thank you

Let's try PWA,

anyway the login, if we develop our own login, how do we make it so that the default abp login does not appear?

Showing 1 to 10 of 27 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on April 16, 2025, 12:13