mirror of https://github.com/abpframework/abp.git
16 changed files with 200 additions and 186 deletions
@ -1,36 +0,0 @@ |
|||
using System.Security.Principal; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore; |
|||
using Microsoft.AspNetCore.Authentication; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using OpenIddict.Server.AspNetCore; |
|||
using Volo.Abp.AspNetCore.MultiTenancy; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace Volo.Abp.OpenIddict; |
|||
|
|||
public class AbpOpenIddictTenantResolveContributor : HttpTenantResolveContributorBase |
|||
{ |
|||
public const string ContributorName = "AbpOpenIddict"; |
|||
|
|||
public override string Name => ContributorName; |
|||
|
|||
protected async override Task<string> GetTenantIdOrNameFromHttpContextOrNullAsync(ITenantResolveContext context, HttpContext httpContext) |
|||
{ |
|||
if (context.ServiceProvider.GetRequiredService<ICurrentUser>().IsAuthenticated) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
if (httpContext.GetOpenIddictServerRequest() != null) |
|||
{ |
|||
context.Handled = true; |
|||
var principal = (await httpContext.AuthenticateAsync(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme)).Principal; |
|||
return principal?.FindTenantId().ToString(); |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
} |
|||
@ -1,8 +1,16 @@ |
|||
namespace Volo.Abp.OpenIddict.WildcardDomains; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.OpenIddict.WildcardDomains; |
|||
|
|||
public class AbpOpenIddictWildcardDomainOptions |
|||
{ |
|||
public bool EnableWildcardDomainSupport { get; set; } |
|||
|
|||
public string WildcardDomainFormat { get; set; } |
|||
public HashSet<string> WildcardDomainsFormat { get; } |
|||
|
|||
public AbpOpenIddictWildcardDomainOptions() |
|||
{ |
|||
WildcardDomainsFormat = new HashSet<string>(); |
|||
} |
|||
|
|||
} |
|||
|
|||
Loading…
Reference in new issue