Yes, sure. Could you please let me know convenient time intervals for you in UTC? As I understand, we have a noticable timeshift. I'm also leaving for vacation tomorrow till 26th of Oct.
I can't close this ticket yet, because after installing ABP 3.2, where the authentication workflow has been changed, our refresh token funcitonality does not work anymore - user is not logged off after refresh interval passes.
We would like to know in details, how exactly the corresponding functionality has been changed since the previous ABP versions and how our code needs to be adopted to make token work again.
Here it is:
2020-10-14 09:53:15.234 +00:00 [INF] Starting AbxEps.CentralTools.IdentityServer.
2020-10-14 09:53:19.927 +00:00 [INF] User profile is available. Using 'C:\Users\IdentityServerAppPool\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
2020-10-14 09:53:20.032 +00:00 [INF] Loaded ABP modules:
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Castle.AbpCastleCoreModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Autofac.AbpAutofacModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Sms.AbpSmsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Localization.AbpLocalizationAbstractionsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Security.AbpSecurityModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Validation.AbpValidationAbstractionsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.ObjectExtending.AbpObjectExtendingModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Uow.AbpUnitOfWorkModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Data.AbpDataModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.MultiTenancy.AbpMultiTenancyModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Settings.AbpSettingsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Timing.AbpTimingModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Json.AbpJsonModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.BackgroundJobs.AbpBackgroundJobsAbstractionsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Localization.AbpLocalizationModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.TextTemplating.AbpTextTemplatingModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Emailing.AbpEmailingModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.ObjectMapping.AbpObjectMappingModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Threading.AbpThreadingModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Auditing.AbpAuditingModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AutoMapper.AbpAutoMapperModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.EventBus.AbpEventBusModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Guids.AbpGuidsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Domain.AbpDddDomainModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Users.AbpUsersDomainSharedModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Validation.AbpValidationModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Features.AbpFeaturesModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityDomainSharedModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Users.AbpUsersAbstractionModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Users.AbpUsersDomainModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityDomainModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Identity.AspNetCore.AbpIdentityAspNetCoreModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Http.AbpHttpAbstractionsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Minify.AbpMinifyModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Http.AbpHttpModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Authorization.AbpAuthorizationModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.UI.AbpUiModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.AbpAspNetCoreModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.ApiVersioning.AbpApiVersioningAbstractionsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Application.AbpDddApplicationContractsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.Application.AbpDddApplicationModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcContractsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.GlobalFeatures.AbpGlobalFeaturesModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.UI.Navigation.AbpUiNavigationModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.AbpAspNetCoreMvcUiModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.AbpAspNetCoreMvcUiBootstrapModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Bundling.AbpAspNetCoreMvcUiBundlingModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Packages.AbpAspNetCoreMvcUiPackagesModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Widgets.AbpAspNetCoreMvcUiWidgetsModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.AbpAspNetCoreMvcUiThemeSharedModule
2020-10-14 09:53:20.033 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Theme.Commercial.AbpAspNetCoreMvcUiThemeCommercialModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementApplicationContractsModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityApplicationContractsModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Ldap.AbpLdapModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Account.AbpAccountSharedApplicationContractsModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Account.AbpAccountPublicApplicationContractsModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityHttpApiModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Account.AbpAccountPublicHttpApiModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Account.Public.Web.AbpAccountPublicWebModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.IdentityServer.AbpIdentityServerDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Serialization.AbpSerializationModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Caching.AbpCachingModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.BackgroundWorkers.AbpBackgroundWorkersModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.IdentityServer.AbpIdentityServerDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Account.Web.AbpAccountPublicWebIdentityServerModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.AspNetCore.MultiTenancy.AbpAspNetCoreMultiTenancyModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.AbpAspNetCoreMvcUiMultiTenancyModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.LeptonTheme.Management.LeptonThemeManagementDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.LeptonTheme.Management.LeptonThemeManagementApplicationContractsModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.LeptonTheme.LeptonThemeManagementHttpApiModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.LeptonTheme.Management.LeptonThemeManagementWebModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton.AbpAspNetCoreMvcUiLeptonThemeModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.PermissionManagement.AbpPermissionManagementApplicationModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.SettingManagement.AbpSettingManagementDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Identity.AbpIdentityApplicationModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Account.AbpAccountSharedApplicationModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.BlobStoring.AbpBlobStoringModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Account.AbpAccountPublicApplicationModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.AuditLogging.AbpAuditLoggingDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.BackgroundJobs.AbpBackgroundJobsDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.LanguageManagement.LanguageManagementDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Saas.SaasDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.BlobStoring.Database.BlobStoringDatabaseDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - AbxEps.CentralTools.CentralToolsDomainSharedModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.AuditLogging.AbpAuditLoggingDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.BackgroundJobs.AbpBackgroundJobsModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.BackgroundJobs.AbpBackgroundJobsDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.FeatureManagement.AbpFeatureManagementDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.PermissionManagement.Identity.AbpPermissionManagementDomainIdentityModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.PermissionManagement.IdentityServer.AbpPermissionManagementDomainIdentityServerModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Saas.SaasDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.LeptonTheme.Management.LeptonThemeManagementDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.LanguageManagement.LanguageManagementDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Commercial.SuiteTemplates.VoloAbpCommercialSuiteTemplatesModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.BlobStoring.Database.BlobStoringDatabaseDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - AbxEps.CentralTools.CentralToolsDomainModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Users.EntityFrameworkCore.AbpUsersEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.IdentityServer.EntityFrameworkCore.AbpIdentityServerEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.PermissionManagement.EntityFrameworkCore.AbpPermissionManagementEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.SettingManagement.EntityFrameworkCore.AbpSettingManagementEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.BackgroundJobs.EntityFrameworkCore.AbpBackgroundJobsEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.AuditLogging.EntityFrameworkCore.AbpAuditLoggingEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.FeatureManagement.EntityFrameworkCore.AbpFeatureManagementEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Abp.LanguageManagement.EntityFrameworkCore.LanguageManagementEntityFrameworkCoreModule
2020-10-14 09:53:20.034 +00:00 [INF] - Volo.Saas.EntityFrameworkCore.SaasEntityFrameworkCoreModule
2020-10-14 09:53:20.035 +00:00 [INF] - Volo.Abp.BlobStoring.Database.EntityFrameworkCore.BlobStoringDatabaseEntityFrameworkCoreModule
2020-10-14 09:53:20.035 +00:00 [INF] - AbxEps.CentralTools.EntityFrameworkCore.CentralToolsEntityFrameworkCoreModule
2020-10-14 09:53:20.035 +00:00 [INF] - AbxEps.CentralTools.CentralToolsIdentityServerModule
2020-10-14 09:53:20.634 +00:00 [DBG] Started background worker: Volo.Abp.IdentityServer.Tokens.TokenCleanupBackgroundWorker
2020-10-14 09:53:20.914 +00:00 [INF] Starting IdentityServer4 version 3.1.3.0
2020-10-14 09:53:21.367 +00:00 [INF] Using the default authentication scheme Identity.Application for IdentityServer
2020-10-14 09:53:21.367 +00:00 [DBG] Using Identity.Application as default ASP.NET Core scheme for authentication
2020-10-14 09:53:21.367 +00:00 [DBG] Using Identity.External as default ASP.NET Core scheme for sign-in
2020-10-14 09:53:21.367 +00:00 [DBG] Using Identity.External as default ASP.NET Core scheme for sign-out
2020-10-14 09:53:21.367 +00:00 [DBG] Using Identity.Application as default ASP.NET Core scheme for challenge
2020-10-14 09:53:21.367 +00:00 [DBG] Using Identity.Application as default ASP.NET Core scheme for forbid
2020-10-14 09:53:21.724 +00:00 [INF] Initialized all ABP modules.
2020-10-14 09:53:21.755 +00:00 [INF] Application started. Press Ctrl+C to shut down.
2020-10-14 09:53:21.755 +00:00 [INF] Hosting environment: AzureDev
2020-10-14 09:53:21.756 +00:00 [INF] Content root path: C:\inetpub\wwwroot\Test\IdentityServer
2020-10-14 09:53:21.780 +00:00 [INF] Request starting HTTP/2.0 GET https://xxxxxx.azure.com/identityserver/.well-known/openid-configuration
2020-10-14 09:53:25.014 +00:00 [DBG] Login Url: /Account/Login
2020-10-14 09:53:25.014 +00:00 [DBG] Login Return Url Parameter: ReturnUrl
2020-10-14 09:53:25.014 +00:00 [DBG] Logout Url: /Account/Logout
2020-10-14 09:53:25.014 +00:00 [DBG] ConsentUrl Url: /Consent
2020-10-14 09:53:25.014 +00:00 [DBG] Consent Return Url Parameter: returnUrl
2020-10-14 09:53:25.014 +00:00 [DBG] Error Url: /Account/Error
2020-10-14 09:53:25.014 +00:00 [DBG] Error Id Parameter: errorId
2020-10-14 09:53:26.098 +00:00 [DBG] Security stamp validation failed, rejecting cookie.
2020-10-14 09:53:26.107 +00:00 [INF] AuthenticationScheme: Identity.Application signed out.
2020-10-14 09:53:26.108 +00:00 [INF] AuthenticationScheme: Identity.External signed out.
2020-10-14 09:53:26.108 +00:00 [INF] AuthenticationScheme: Identity.TwoFactorUserId signed out.
2020-10-14 09:53:26.123 +00:00 [INF] Identity.Application was not authenticated. Failure message: No principal.
2020-10-14 09:53:26.321 +00:00 [INF] Identity.Application was not authenticated. Failure message: No principal.
2020-10-14 09:53:26.327 +00:00 [INF] Identity.Application was not authenticated. Failure message: No principal.
2020-10-14 09:53:26.330 +00:00 [DBG] Request path /.well-known/openid-configuration matched to endpoint type Discovery
2020-10-14 09:53:26.785 +00:00 [DBG] Endpoint enabled: Discovery, successfully created handler: IdentityServer4.Endpoints.DiscoveryEndpoint
2020-10-14 09:53:26.786 +00:00 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryEndpoint for /.well-known/openid-configuration
2020-10-14 09:53:26.787 +00:00 [DBG] Start discovery request
2020-10-14 09:53:27.192 +00:00 [INF] Request finished in 5418.409ms 200 application/json; charset=UTF-8
2020-10-14 09:53:27.252 +00:00 [INF] Request starting HTTP/2.0 GET https://xxxxxx.azure.com/identityserver/.well-known/openid-configuration/jwks
2020-10-14 09:53:27.272 +00:00 [DBG] Request path /.well-known/openid-configuration/jwks matched to endpoint type Discovery
2020-10-14 09:53:27.297 +00:00 [DBG] Endpoint enabled: Discovery, successfully created handler: IdentityServer4.Endpoints.DiscoveryKeyEndpoint
2020-10-14 09:53:27.297 +00:00 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.DiscoveryKeyEndpoint for /.well-known/openid-configuration/jwks
2020-10-14 09:53:27.298 +00:00 [DBG] Start key discovery request
2020-10-14 09:53:27.312 +00:00 [INF] Request finished in 60.1142ms 200 application/jwk-set+json; charset=UTF-8
2020-10-14 10:14:14.550 +00:00 [DBG] Stopped background worker: Volo.Abp.IdentityServer.Tokens.TokenCleanupBackgroundWorker
2020-10-14 10:14:14.551 +00:00 [INF] Application is shutting down...
Thank you. I will give it a try later on, because requirements have changed. Could you please explain why I cannot reopen another ticket (which I closed) or add answer? When I'm trying to do that, I receive the message saying I am not authorized to do that (I AM logged in).
OK. We implemented service on Angular side and seems like everything works now.
Good, but from ABP-based project's prospective, does it need to be something like this in front-end part: Angular Refresh Token implementation and from back-end part probably nothing needs to be added to make it work?
Hi, could you please make a short test example how to work with refresh_token? In current implementation (built from ABP template) we use only access_token.
Ok, thank you!
@maliming
we have managed to do that by our owns:
BACK-END: implemented & registered custom grant type validator in IdentityServer project:
SwitchToTenantGrantValidator : IdentityServer4.Validation.IExtensionGrantValidator
In short, ValidateAsync accepts the data of authenticated user (his access token, tenant ID, etc.) and makes the decision if the user has to be let in. The method writes data of target tenant into context result object;
FRONT-END: made a call to IdentityServer with the given custom grant type, supplying data required for (1). We used Angular, so I had to extend OAuthService package to support custom grant type request;
Still need to bring everything in order (if (2) was successful) to display correct data in UI: clean old states, etc. - since now old user is still displayed for some reason (despite dispatching new GetAppConfiguration);
The question that is still open: why you hardcoded custom grant type names? When we added manually some custom name to DB - it worked. But in ABP Identity Server management page we cannot do that.
Could you please make a test project demonstrating how to accomplish our goal? I've spent a lot of time searching for solution on stackoverflow, analyzing ABP code, etc. and I am far behind the schedule. But the solution is still not working.
The pieces of code I have ended up with are the following:
[Authorize]
public async Task<PagedResultDto<LookupDto<string>>> GetTenantsForCurrentUser()
{
if (!CurrentUser.IsAuthenticated)
return null;
var items = await _abxUserRepository.FindTenantsByLoginAsync(CurrentUser.UserName);
return new PagedResultDto<LookupDto<string>>
{
TotalCount = items.Count(),
Items = ObjectMapper.Map<List<Tenant>, List<LookupDto<string>>>(items)
};
}
<div *ngIf="user.isAuthenticated" class="dropdown btn-group" ngbDropdown>
<a
class="btn"
role="button"
id="dropdownMenuTenantsLink"
ngbDropdownToggle
*ngIf="(selectedTenant$ | async)?.name as tenantName"
>
<span>{{ '::Tenants:CurrentTenant' | abpLocalization }}: <b>{{ tenantName }}</b></span>
</a>
<div
ngbDropdownMenu
class="dropdown-menu dropdown-menu-right"
*ngIf="dropdownTenants$ | async"
>
<h6 class="dropdown-header">{{ '::Tenants:SwitchTenant' | abpLocalization }}</h6>
<a
*ngFor="let tenant of dropdownTenants$ | async"
class="dropdown-item pointer"
(click)="switchTenant(user.userName, tenant)"
>
{{ tenant.displayName }}</a
>
</div>
</div>
switchTenant(userName: string, tenant: Common.Lookup<string>) {
this.oAuthService.configure(
this.store.selectSnapshot(ConfigState.getOne('environment')).oAuthConfig,
);
return from(this.oAuthService.loadDiscoveryDocument())
.pipe(
switchMap(() =>
from(
this.oAuthService.fetchTokenUsingGrant(
'Custom', // why we cannot use own name??
null,
new HttpHeaders(
{ ...(tenant.id && { __tenant: tenant.id })}
&& (userName && { user: userName })
)
),
),
),
switchMap(() => this.store.dispatch(new GetAppConfiguration())),
tap(() => {
const redirectUrl =
snq(() => window.history.state.redirectUrl) || (this.options || {}).redirectUrl || '/';
this.store.dispatch(new Navigate([redirectUrl]));
}),
take(1),
).subscribe(() => {});
}
All in all, the idea is:
in app service layer to get the list of all tenants for current user (login name) - see above;
fill dropdown of tenants for passwordless login and supply the tenant id for each entry - see above;
make request from Angular app (using oAuthService->[some passwordless workflow?]) supplying the access token of currently authenticated user, some custom passwordless grant-type and tenant id in order to login (custom extension validator is going to intercept this request on server-side and approve or reject the login).
is the most tricky part, since OAuthService still does not support custom grant type. I've tried to patch the latest angular-oauth2-oidc from github (10.x) and add fetchTokenUsingGrant, but how to update our solution to the patched version? Your framework uses this package inside and I even cannot see angular-oauth2-oidc via npm outdated.