Activities of "jlavallet"

So I used the ExposeServices tweak to register the IdentityServerSupportedLoginModel, changed my class to inherit from it, and I switched back to the call to the base constructor for that base class. Everything works including my code down below.

However, I can't understand why the Tenant selection is still showing. How do I hide that on the UI?


[ExposeServices(typeof(CustomLoginModel), typeof(IdentityServerSupportedLoginModel))]
public class CustomLoginModel : IdentityServerSupportedLoginModel
{
  private readonly ITenantRepository _tenantRepository;

  public CustomLoginModel(
    IAuthenticationSchemeProvider schemeProvider,
    IOptions<AbpAccountOptions> accountOptions,
    IAccountExternalProviderAppService accountExternalProvider,
    IIdentityServerInteractionService interaction,
    IClientStore clientStore,
    IEventService identityServerEvents,
    ICurrentPrincipalAccessor currentPrincipalAccessor,
    IAbpRecaptchaValidatorFactory recaptchaValidatorFactory,
    IOptions<IdentityOptions> identityOptions,
    IOptionsSnapshot<reCAPTCHAOptions> reCaptchaOptions,
    ITenantRepository tenantRepository)
    : base(schemeProvider, accountOptions, accountExternalProvider, interaction, clientStore, identityServerEvents,
      currentPrincipalAccessor, recaptchaValidatorFactory, identityOptions, reCaptchaOptions)
  {
    _tenantRepository = tenantRepository;
  }

  public override async Task<IActionResult> OnPostAsync(string action)
  {
    var user = await FindUserAsync(LoginInput.UserNameOrEmailAddress);
    using (CurrentTenant.Change(user?.TenantId))
    {
      return await base.OnPostAsync(action);
    }
  }

  public override async Task<IActionResult> OnGetExternalLoginCallbackAsync(string returnUrl = "",
    string returnUrlHash = "", string remoteError = null)
  {
    var user = await FindUserAsync(LoginInput.UserNameOrEmailAddress);
    using (CurrentTenant.Change(user?.TenantId))
    {
      return await base.OnGetExternalLoginCallbackAsync(returnUrl, returnUrlHash, remoteError);
    }
  }

  protected virtual async Task<IdentityUser> FindUserAsync(string uniqueUserNameOrEmailAddress)
  {
    IdentityUser user = null;
    using (CurrentTenant.Change(null))
    {
      user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress) ??
             await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress);

      if (user != null)
      {
        return user;
      }
    }

    foreach (var tenant in await _tenantRepository.GetListAsync())
    {
      using (CurrentTenant.Change(tenant.Id))
      {
        user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress) ??
               await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress);

        if (user != null)
        {
          return user;
        }
      }
    }

    return null;
  }
}

Removing all my code and reverting it back to what it was is not the solution I was looking for. I am trying to implement a solution whereby the tenant entry is not necessary. If you looked at my code you would see that. Can you try again?

the link has been deleted by admin

I tried every combination of everything that I could find, and the certificate just would not be trusted. I am running a Windows Insider build of Windows 11 – perhaps that has something to do with something. Anyway, once I switched over to a remote work PC, I was able to get the certificate installed and trusted.

I read the 4980 issue thread and upgraded my NPM. When I ran abp install-libs again, several things were downloaded.

As far as the certificate problem goes, here is the application log from Tye for the public gateway site:

Logs for web-public-gateway
 
[web-public-gateway_3fa350d4-d]:D:\Century\Clients\PigglyWiggly\RPMS\PWADC.GoRPMS\gateways\web-public\src\PWADC.GoRPMS.PublicWebGateway\bin\Debug\net6.0\PWADC.GoRPMS.PublicWebGateway.exe
[web-public-gateway_3fa350d4-d]: [09:05:15 INF] Starting PWADC.GoRPMS.PublicWebGateway.
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] Loaded ABP modules:
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - PWADC.GoRPMS.PublicWebGateway.GoRPMSPublicWebGatewayModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - PWADC.GoRPMS.Shared.Hosting.Gateways.GoRPMSSharedHostingGatewaysModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - PWADC.GoRPMS.Shared.Hosting.AspNetCore.GoRPMSSharedHostingAspNetCoreModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - PWADC.GoRPMS.Shared.Hosting.GoRPMSSharedHostingModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Autofac.AbpAutofacModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Castle.AbpCastleCoreModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Data.AbpDataModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.ObjectExtending.AbpObjectExtendingModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Localization.AbpLocalizationAbstractionsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Validation.AbpValidationAbstractionsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Uow.AbpUnitOfWorkModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.EventBus.Abstractions.AbpEventBusAbstractionsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Serilog.AbpAspNetCoreSerilogModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.MultiTenancy.AbpMultiTenancyModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Security.AbpSecurityModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.AbpAspNetCoreModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Auditing.AbpAuditingModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Json.AbpJsonModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Timing.AbpTimingModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Localization.AbpLocalizationModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Settings.AbpSettingsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Threading.AbpThreadingModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Auditing.AbpAuditingContractsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Http.AbpHttpModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Http.AbpHttpAbstractionsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Minify.AbpMinifyModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Authorization.AbpAuthorizationModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Authorization.AbpAuthorizationAbstractionsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Validation.AbpValidationModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.ExceptionHandling.AbpExceptionHandlingModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Swashbuckle.AbpSwashbuckleModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.ApiVersioning.AbpApiVersioningAbstractionsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcContractsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Application.AbpDddApplicationContractsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.UI.Navigation.AbpUiNavigationModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.UI.AbpUiModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.GlobalFeatures.AbpGlobalFeaturesModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Application.AbpDddApplicationModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Domain.AbpDddDomainModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.EventBus.AbpEventBusModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Guids.AbpGuidsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.BackgroundWorkers.AbpBackgroundWorkersModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.DistributedLocking.AbpDistributedLockingAbstractionsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.ObjectMapping.AbpObjectMappingModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Specifications.AbpSpecificationsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.Features.AbpFeaturesModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.AbpAspNetCoreMvcUiMultiTenancyModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.AbpAspNetCoreMvcUiThemeSharedModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.AbpAspNetCoreMvcUiBootstrapModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.UI.AbpAspNetCoreMvcUiModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.UI.Packages.AbpAspNetCoreMvcUiPackagesModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.UI.Bundling.AbpAspNetCoreMvcUiBundlingAbstractionsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.UI.Widgets.AbpAspNetCoreMvcUiWidgetsModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.Mvc.UI.Bundling.AbpAspNetCoreMvcUiBundlingModule
[web-public-gateway_3fa350d4-d]: [09:05:16 INF] - Volo.Abp.AspNetCore.MultiTenancy.AbpAspNetCoreMultiTenancyModule
[web-public-gateway_3fa350d4-d]: [09:05:17 INF] Initialized all ABP modules.
[web-public-gateway_3fa350d4-d]: [09:05:17 INF] User profile is available. Using 'C:\Users\passp\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
[web-public-gateway_3fa350d4-d]: [09:05:17 INF] Now listening on: https://localhost:44353
[web-public-gateway_3fa350d4-d]: [09:05:17 INF] Application started. Press Ctrl+C to shut down.
[web-public-gateway_3fa350d4-d]: [09:05:17 INF] Hosting environment: Development
[web-public-gateway_3fa350d4-d]: [09:05:17 INF] Content root path: D:\Century\Clients\PigglyWiggly\RPMS\PWADC.GoRPMS\gateways\web-public\src\PWADC.GoRPMS.PublicWebGateway\

What is the result when you run npm -v

PS C:\Users\passp> npm -v
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.11.0
PS C:\Users\passp>

The dev-certs is only working on domain localhost, can you share the full logs?

PS C:\Users\passp> cd D:\Century\Clients\PigglyWiggly\RPMS\PWADC.GoRPMS
PS D:\Century\Clients\PigglyWiggly\RPMS\PWADC.GoRPMS> .\etc\dev-cert\create-certificate.ps1
Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously trusted. Click yes on the prompt to trust the certificate.
[1] Listing certificates from CurrentUser\My
[2] Found certificates: 1 certificate
    1) D6A8FF9E96302EC89AC86045A5F8EBC6EAA62D35 - CN=localhost - Valid from 2022-06-02 15:18:41Z to 2023-06-02 15:18:41Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
[3] Checking certificates validity
[4] Valid certificates: 1 certificate
    1) D6A8FF9E96302EC89AC86045A5F8EBC6EAA62D35 - CN=localhost - Valid from 2022-06-02 15:18:41Z to 2023-06-02 15:18:41Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
[5] Invalid certificates: no certificates
[6] Finished listing certificates.
[1] Listing certificates from LocalMachine\My
[2] Found certificates: no certificates
[3] Checking certificates validity
[4] Valid certificates: no certificates
[5] Invalid certificates: no certificates
[6] Finished listing certificates.
[8] Filtered certificates: 1 certificate
    1) D6A8FF9E96302EC89AC86045A5F8EBC6EAA62D35 - CN=localhost - Valid from 2022-06-02 15:18:41Z to 2023-06-02 15:18:41Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
[9] Excluded certificates: no certificates
[14] Valid certificates: 1 certificate
    1) D6A8FF9E96302EC89AC86045A5F8EBC6EAA62D35 - CN=localhost - Valid from 2022-06-02 15:18:41Z to 2023-06-02 15:18:41Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
[15] Selected certificate: D6A8FF9E96302EC89AC86045A5F8EBC6EAA62D35 - CN=localhost - Valid from 2022-06-02 15:18:41Z to 2023-06-02 15:18:41Z - IsHttpsDevelopmentCertificate: true - IsExportable: true
[23] Saving certificate 'D6A8FF9E96302EC89AC86045A5F8EBC6EAA62D35 - CN=localhost - Valid from 2022-06-02 15:18:41Z to 2023-06-02 15:18:41Z - IsHttpsDevelopmentCertificate: true - IsExportable: true' to localhost.pfx with private key.
[27] Writing the certificate to: localhost.pfx.
[29] Trusting the certificate to: D6A8FF9E96302EC89AC86045A5F8EBC6EAA62D35 - CN=localhost - Valid from 2022-06-02 15:18:41Z to 2023-06-02 15:18:41Z - IsHttpsDevelopmentCertificate: true - IsExportable: true.
[45] Adding certificate to the trusted root certification authority store.
[0] Event 30 was called with 1 argument(s), but it is defined with 0 parameter(s).
[30]
A valid HTTPS certificate is already present.
The certificate was exported to D:\Century\Clients\PigglyWiggly\RPMS\PWADC.GoRPMS\localhost.pfx
PS D:\Century\Clients\PigglyWiggly\RPMS\PWADC.GoRPMS> dotnet dev-certs https --clean
Cleaning HTTPS development certificates from the machine. A prompt might get displayed to confirm the removal of some of the certificates.
HTTPS development certificates successfully removed from the machine.
PS D:\Century\Clients\PigglyWiggly\RPMS\PWADC.GoRPMS>  dotnet dev-certs https --trust
Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously trusted. Click yes on the prompt to trust the certificate.
The HTTPS developer certificate was generated successfully.
PS D:\Century\Clients\PigglyWiggly\RPMS\PWADC.GoRPMS>

Let me get it back into a compiled state, and I will send it to you.

Li, I sent you an email regarding a time to do a remote session I am in the Central Standard Time zone (GMT -6). I can make myself available with a little bit of notice.

Okay great. When can I expect that functionality to be released?

In the meantime, could you address the need I expressed?

I had hoped to find some best practices or examples of using the logged in user's role or ID to return data scoped for that user.

Here is a link to a Stack Overflow post I made that goes into more detail: https://stackoverflow.com/questions/70297404/filtering-queries-by-by-user-and-role-scoping-data

Making tthe changes at tthe end of that post did the trick. If the generated code has these settings set to true by default, how is it that many many others are not encountering the same problem? I don't believe my environment was unique by any stretch of the imagination. Why isn't this in the documentation?!

Showing 21 to 30 of 30 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30