Update AbpOpenIddictTenantResolveContributor.cs

pull/12084/head
maliming 4 years ago
parent 5a30a8f006
commit c8a8f99ccc
No known key found for this signature in database
GPG Key ID: 096224957E51C89E

@ -1,5 +1,6 @@
using System.Security.Principal;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
@ -23,7 +24,13 @@ public class AbpOpenIddictTenantResolveContributor : HttpTenantResolveContributo
return null;
}
var principal = (await httpContext.AuthenticateAsync(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme)).Principal;
return principal?.FindTenantId().ToString();
if (httpContext.GetOpenIddictServerRequest() != null)
{
context.Handled = true;
var principal = (await httpContext.AuthenticateAsync(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme)).Principal;
return principal?.FindTenantId().ToString();
}
return null;
}
}

Loading…
Cancel
Save