Browse Source
Update AbpOpenIddictTenantResolveContributor.cs
pull/12084/head
maliming
4 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
1 changed files with
9 additions and
2 deletions
-
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictTenantResolveContributor.cs
|
|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|
|