Activities of "shijo"

Hi We have added a CustomTenantReolver, which is resolving tenant by querystring but after login getting this exception.

InvalidOperationException: The user details cannot be retrieved. Volo.Abp.OpenIddict.Controllers.AuthorizeController.HandleAsync() Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments) Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask<IActionResult> actionResultValueTask) Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)

This is our tenantResolver

public class CustomTenantResolveContributor : TenantResolveContributorBase
    {
        public override string Name => "Custom";
        public async override Task ResolveAsync(ITenantResolveContext context)
        {
            var currentContextAccessor = context.ServiceProvider.GetRequiredService<IHttpContextAccessor>();
            var tenantRepository = context.ServiceProvider.GetRequiredService<ITenantRepository>();
            var tenantName = currentContextAccessor?.HttpContext?.Request.Query["__testtenant"];
            if (tenantRepository != null)
            {
                var tenant = await tenantRepository.FindByNameAsync(tenantName);
                if (tenant != null)
                {
                    context.TenantIdOrName = tenant.Name;
                }
            }
        }
    }

In AuthServer Added this also...

Configure&lt;AbpTenantResolveOptions&gt;(options =>
{
    //options.TenantResolvers.Add(new CookieTenantResolveContributor());
    //options.TenantResolvers.Add(new HeaderTenantResolveContributor());
    options.TenantResolvers.Clear();
    options.TenantResolvers.Add(new CustomTenantResolveContributor());
});

Hi, This is regarding the same issue that I reported, our system is multitenant and we added this to resolve tenants Configure<AbpTenantResolveOptions>(options => { options.TenantResolvers.Add(new CookieTenantResolveContributor()); options.TenantResolvers.Add(new HeaderTenantResolveContributor()); });

While opening the tenant URL, we direct it to Single Sign-On (SSO) by passing the tenant name in the query string, which works perfectly fine. However, the problem we're encountering arises when we attempt to access the admin interface after visiting any tenant URL. In this case, the SSO redirects to the last visited tenant, which is illogical because we don't pass any tenant name for the admin interface in the query string. How can we resolve this issue? I've noticed that the Application Tab and Cookie Information change when accessing specific tenants, but they remain unchanged for the admin interface, retaining the data from the last visit. If you need more clarification please ask.

For Tenant: international this is the sso url, you can see the last query string value is tenant name https://sso.abc.io/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%3Fclient_id%3DAkadimi_App%26redirect_uri%3Dhttps%253A%252F%252Freader.uepuae.ae%26response_type%3Dcode%26scope%3Dopenid%2520email%2520offline_access%2520Akadimi%26nonce%3Df04e445634fb75249028794f875cebe059vFmTywp%26state%3D8b55218695bc1d9f61aadc690ba3b3c1a1Aibm6pm%26code_challenge%3Dzfa46XEa5zOJN1wK0FzDV2T8iUrqxYs4S-oFyvF-esE%26code_challenge_method%3DS256%26__tenant%3Dinternational

For Tenant: aths https://sso.abc.io/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%3Fclient_id%3DAkadimi_App%26redirect_uri%3Dhttps%253A%252F%252Freader.aths.ac.ae%26response_type%3Dcode%26scope%3Dopenid%2520email%2520offline_access%2520Akadimi%26nonce%3Db46cf111bf4dfc3532365277bcb6fd0c62UYZ6bMk%26state%3D3be63e1ba9106fa05d7f4624a9704f1c42UcGrXLF%26code_challenge%3Dr-ZgvXA3Nh3ESTDHD94Nd63-Bx71U5gjU-AGXpwiOC8%26code_challenge_method%3DS256%26__tenant%3Daths

For Admin https://sso.abc.io/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%3Fresponse_type%3Dcode%26client_id%3DAkadimi_App%26state%3DaUpGTlFwdV9kZHBJY09WUS44Wn5PTzhqQ2dXQWZqR3ZSZHk4ZmNDaVdWeE5p%26redirect_uri%3Dhttps%253A%252F%252Fadmin.akadimi.io%26scope%3Dopenid%2520offline_access%2520Akadimi%26code_challenge%3DkcG7_SRBM7yi4GlVPGIpTdTTF6FsA1rXiIqKiSY9pPg%26code_challenge_method%3DS256%26nonce%3DaUpGTlFwdV9kZHBJY09WUS44Wn5PTzhqQ2dXQWZqR3ZSZHk4ZmNDaVdWeE5p%26culture%3Den%26ui-culture%3Den This sso is pointing to the last tenant which we opened.

Hi, I tried the code that is mentioned in the issue, but it's not working. Let me explain the exact problem we are facing. Initially, on the left side, I logged in with Incognito using Tenant1. Then, I opened a new Incognito window with the same URL, and it showed me a logged-in screen with Tenant1. Afterward, I logged out the tenant from the right side and logged in with Tenant2. Now, both the left Incognito and the right side are using Tenant2 user sessions. We want to maintain both sessions simultaneously. If you have any sample projects to share, please do.

I have implemented this in my code.

Scope added in Host Module configuration

  • ABP Framework version: v7.0

  • UI Type: Angular

  • Database System: EF Core SQL Server

  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

  • Exception message and full stack trace:

  • Steps to reproduce the issue:

    1. Open Browser Login with Tenant1
    2. Open a new Tab with the same URL, default Tenant1 is logged-in in new tab Our requirement is that each browser session should prompt for individual login credentials and operate independently. How can we achieve this?
  • ABP Framework version: v7.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server,
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

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

I found 2 references regarding user import below mentioned, In the second solution only inserts users into the IdentityUser table, and the first solution inserts users in the Identity User table with Identity options, which one I should follow? I need to keep some extra user information also

  1. https://github.com/bartvanhoey/AbpUserImport
  2. https://github.com/abpframework/abp-samples/pull/64

Fixed..

Issue solved, Thanks for your support

hi

Set the yourwebsite as your application website.

var healthChecksUiBuilder = services.AddHealthChecksUI(settings => 
{ 
    settings.AddHealthCheckEndpoint("MyProjectName Health Status", "https://yourwebsite.com/health-status"); 
}); 
 
services.MapHealthChecksUiEndpoints(options => 
{ 
    options.UIPath = "https://yourwebsite.com/health-ui"; 
    options.ApiPath = "https://yourwebsite.com/health-api"; 
}); 

I am trying this locally, getting this error in log after setting

GetHealthReport threw an exception when trying to get report from https://localhost:44320/health-status configured with name MyProjectName Health Status.
System.Text.Json.JsonException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
 ---> System.Text.Json.JsonReaderException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonTypeInfo jsonTypeInfo)
   at System.Text.Json.JsonSerializer.ReadFromStreamAsync[TValue](Stream utf8Json, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsyncCore[T](HttpContent content, Encoding sourceEncoding, JsonSerializerOptions options, CancellationToken cancellationToken)
   at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReportAsync(HealthCheckConfiguration configuration) in /_/src/HealthChecks.UI/Core/HostedService/HealthCheckReportCollector.cs:line 126
2023-07-25 13:54:43.554 +04:00 [DBG] HealthReportCollector - health report execution history saved.

hi

Please share full error/exception logs.
Thanks

Hi, This is the exception I am getting. And it keeps killing the pod, and Where is this HealthCheckReportCollector.cs I cannot find any class in my solution.

[07:30:55 INF] Notification is sent on same window time.
   at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReportAsync(HealthCheckConfiguration configuration) in /_/src/HealthChecks.UI/Core/HostedService/HealthCheckReportCollector.cs:line 138
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendAsync>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.<SendAsync>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.ConnectAsync(EndPoint remoteEP, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ConnectAsync(Socket socket)
   at System.Net.Sockets.Socket.ConnectAsync(SocketAsyncEventArgs e, Boolean userSocket, Boolean saeaCancelable)
   at System.Net.Dns.GetHostEntryOrAddressesCoreAsync(String hostName, Boolean justReturnParsedIp, Boolean throwOnIIPAny, Boolean justAddresses, AddressFamily family, CancellationToken cancellationToken)
 ---> System.ArgumentException: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses that cannot be used as a target address. (Parameter 'hostName')
System.Net.Http.HttpRequestException: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses that cannot be used as a target address. (Parameter 'hostName') ([::]:80)
[07:30:55 ERR] GetHealthReport threw an exception when trying to get report from /health-status configured with name SSO Health Status.
[07:30:55 INF] Sending HTTP request GET http://[::]/health-status
[07:30:55 INF] Start processing HTTP request GET http://[::]/health-status
[07:30:54 INF] Notification is sent on same window time.
   at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReportAsync(HealthCheckConfiguration configuration) in /_/src/HealthChecks.UI/Core/HostedService/HealthCheckReportCollector.cs:line 138
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendAsync>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.<SendAsync>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.ConnectAsync(EndPoint remoteEP, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ConnectAsync(Socket socket)
   at System.Net.Sockets.Socket.ConnectAsync(SocketAsyncEventArgs e, Boolean userSocket, Boolean saeaCancelable)
   at System.Net.Dns.GetHostEntryOrAddressesCoreAsync(String hostName, Boolean justReturnParsedIp, Boolean throwOnIIPAny, Boolean justAddresses, AddressFamily family, CancellationToken cancellationToken)
 ---> System.ArgumentException: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses that cannot be used as a target address. (Parameter 'hostName')
System.Net.Http.HttpRequestException: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses that cannot be used as a target address. (Parameter 'hostName') ([::]:80)
[07:30:54 ERR] GetHealthReport threw an exception when trying to get report from /health-status configured with name SSO Health Status.
[07:30:54 INF] Sending HTTP request GET http://[::]/health-status
[07:30:54 INF] Start processing HTTP request GET http://[::]/health-status
Showing 11 to 20 of 109 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11