@ -289,13 +289,15 @@ Configure<AbpTenantResolveOptions>(options =>
* This should be done in the *Web/API Layer* since the URL is a web related stuff.
Openiddict is the default Auth Server in ABP (since v6.0). When you use OpenIddict, you must add this code to the `PreConfigure` method as well.
```csharp
// using Volo.Abp.OpenIddict.WildcardDomains
PreConfigure< AbpOpenIddictWildcardDomainOptions > (options=>{
PreConfigure< AbpOpenIddictWildcardDomainOptions > (options =>
{
options.EnableWildcardDomainSupport = true;
options.WildcardDomainsFormat.Add("https://{0}.mydomain.com");
});
});
```
You must add this code to the `Configure` method as well.
@ -303,43 +305,42 @@ You must add this code to the `Configure` method as well.
```csharp
// using Volo.Abp.MultiTenancy;
Configure< AbpTenantResolveOptions > (options=>{
Configure< AbpTenantResolveOptions > (options =>
{
options.AddDomainTenantResolver("{0}.mydomain.com");
});
});
```
> There is an [example ](https://github.com/abpframework/abp-samples/tree/master/DomainTenantResolver ) that uses the subdomain to determine the current tenant.
If you use a sepereted Auth server, you must install `Owl.TokenWildcardIssuerValidator` on the HTTPApi.Host project
If you use a sepereted Auth server, you must install `[Owl.TokenWildcardIssuerValidator](https://www.nuget.org/packages/Owl.TokenWildcardIssuerValidator)` on the `HTTPApi.Host` project
```bash
dotnet add package Owl.TokenWildcardIssuerValidator
```
Then fix the options of the `.AddJwtBearer` block
```csharp
// using using Owl.TokenWildcardIssuerValidator;
context.Services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
context.Services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(
configuration["AuthServer:RequireHttpsMetadata"]
);
options.Audience = "ExampleProjectName";
// start of added block
options.TokenValidationParameters.IssuerValidator =
TokenWildcardIssuerValidator.IssuerValidator;
options.TokenValidationParameters.ValidIssuers = new[]
{
"https://{0}.mydomain.com:44349/" //the port may different
};
// end of added block
});
}
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
options.Audience = "ExampleProjectName";
// start of added block
options.TokenValidationParameters.IssuerValidator = TokenWildcardIssuerValidator.IssuerValidator;
options.TokenValidationParameters.ValidIssuers = new[]
{
"https://{0}.mydomain.com:44349/" //the port may different
};
// end of added block
});
```