Hi ismcagdas,
Yes, I will send an email as you requested, but we really need your assistance and support to make this functionality work by March 22nd. We have been trying to make this work for months, and we now need to close the project and this functionality still does not work at all.
If it is easier, we can schedule a conference call with one of your experts to discuss further. In the meantime, we will send the email to [email protected]
Thank you!
Greetings to all.
Following his recommendation, the use of Redis in the cloud was implemented, for which the ConnectionString was added and the correct cache exchange was verified. But unfortunately the problem persists in the Impersonate, the behavior is the same, the source user's session has been lost in the middle of the impersonate process.
Can you please tell me if there are successful cases of the use of this functionality with your framework on AWS under the architecture that I explained in the original message?
And if the answer is positive, can you please tell me if it is necessary to implement something additional so that the session is also maintained in Redis or it is enough to enable the use of Redis Cache at a general level without additional implementations?
If the answer is negative, can you tell us what would be the alternative way to follow to be able to use this functionality please? Since we need to give a solution to this requirement.
Hi,
I resend the required since it has been 15 days since last answer from support team and we need to progress with this issue. Thanks.
"Greetings and thanks for your response. Yes, we have several instances on EC2, because we are in the process of developing features and we have a working production environment.
It is the same application that is deployed in different environments for quality control until it reaches Production, but they are completely separate instances from one another, each with its API, its web application (UI) and its own DB, access to these for the same domain in CloudFlare using cnames:
https://dev.aequales.com/ https://qa.aequales.com/ https://uat.aequales.com/ ......"
image.png
Greetings and thanks for your response. Yes, we have several instances on EC2, because we are in the process of developing features and we have a working production environment.
It is the same application that is deployed in different environments for quality control until it reaches Production, but they are completely separate instances from one another, each with its API, its web application (UI) and its own DB, access to these for the same domain in CloudFlare using cnames:
https://dev.aequales.com/ https://qa.aequales.com/ https://uat.aequales.com/ ......
Greetings everyone, please I request your help with this case. We have a problem applying the concept of User Impersonate, which works correctly in the development environment, but in a production environment mounted on AWS Elastic Beanstalk and NGINX as a web server, it does not work because the cache loses the data of the user who performs the impersonation. The error we get is the following:
Abp.Authorization.AbpAuthorizationException: The current tenant is different from the given tenant. AbpSession.TenantId: , given tenant id: 1 in PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in /builds/webcreeklab/platformpar/aspnet-core/src/PARPlatform.Web.Core/Controllers/TokenAuthController.cs:line 402 at lambda_method4875(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object handler, Object[] arguments) Caller, TaskInTakerController, LastActionTask) Next State, Scope, Object State, Boolean is Completed)
And that happens in this method of the ImpersonationManager class where AbpSession.TenantId is NULL:
private void CheckCurrentTenant(int? tenantId) { if (AbpSession.TenantId != tenantId) { throw new Exception($"Current tenant is different than given tenant. AbpSession.TenantId: {AbpSession.TenantId}, given tenantId: {tenantId}"); } }
For this reason, we require your support to understand what the problem is and how to solve it. Thank you
Sep 14 21:03:07 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:07,465 [31 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:07 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:07 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:07 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:07 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:07 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask
1 actionResultValueTask)
Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:07 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:09 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:09,284 [31 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:09 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:09 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:09 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:09 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:09 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask
1 actionResultValueTask)
Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:09 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:11 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:11,232 [31 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:11 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:11 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:11 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:11 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:11 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask
1 actionResultValueTask)
Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:11 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:13 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:13,333 [26 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:13 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:13 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:13 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:13 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:13 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask
1 actionResultValueTask)
Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:13 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:20 ip-172-30-1-6 web: ERROR 2022-09-14 21:03:20,164 [32 ] Mvc.ExceptionHandling.AbpExceptionFilter - Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:20 ip-172-30-1-6 web: System.Exception: Current tenant is different than given tenant. AbpSession.TenantId: , given tenantId: 2
Sep 14 21:03:20 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.CheckCurrentTenant(Nullable1 tenantId) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 113 Sep 14 21:03:20 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 42 Sep 14 21:03:20 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379 Sep 14 21:03:20 ip-172-30-1-6 web: at lambda_method2674(Closure , Object ) Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask
1 actionResultValueTask)
Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:03:20 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
Sep 14 21:04:22 ip-172-30-1-6 web: WARN 2022-09-14 21:04:22,701 [27 ] Mvc.ExceptionHandling.AbpExceptionFilter -
Sep 14 21:04:22 ip-172-30-1-6 web: Token de personificación es inválido o ha expirado!
Sep 14 21:04:22 ip-172-30-1-6 web: Abp.UI.UserFriendlyException:
Sep 14 21:04:22 ip-172-30-1-6 web: Token de personificación es inválido o ha expirado!
Sep 14 21:04:22 ip-172-30-1-6 web: at PARPlatform.Authorization.Impersonation.ImpersonationManager.GetImpersonatedUserAndIdentity(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Core\Authorization\Impersonation\ImpersonationManager.cs:line 39
Sep 14 21:04:22 ip-172-30-1-6 web: at PARPlatform.Web.Controllers.TokenAuthController.ImpersonatedAuthenticate(String impersonationToken) in C:\Users\pedro\OneDrive\Documentos\plataformapar\aspnet-core\src\PARPlatform.Web.Core\Controllers\TokenAuthController.cs:line 379
Sep 14 21:04:22 ip-172-30-1-6 web: at lambda_method2674(Closure , Object )
Sep 14 21:04:22 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
Sep 14 21:04:22 ip-172-30-1-6 web: at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)