Browse Source

Format the c# code.

pull/17774/head
maliming 3 years ago
committed by GitHub
parent
commit
03fa59c8ff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 51
      docs/en/Multi-Tenancy.md

51
docs/en/Multi-Tenancy.md

@ -289,13 +289,15 @@ Configure<AbpTenantResolveOptions>(options =>
* This should be done in the *Web/API Layer* since the URL is a web related stuff. * 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. 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 ```csharp
// using Volo.Abp.OpenIddict.WildcardDomains // using Volo.Abp.OpenIddict.WildcardDomains
PreConfigure<AbpOpenIddictWildcardDomainOptions>(options=>{ PreConfigure<AbpOpenIddictWildcardDomainOptions>(options =>
{
options.EnableWildcardDomainSupport = true; options.EnableWildcardDomainSupport = true;
options.WildcardDomainsFormat.Add("https://{0}.mydomain.com"); options.WildcardDomainsFormat.Add("https://{0}.mydomain.com");
}); });
``` ```
You must add this code to the `Configure` method as well. 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 ```csharp
// using Volo.Abp.MultiTenancy; // using Volo.Abp.MultiTenancy;
Configure<AbpTenantResolveOptions>(options=>{ Configure<AbpTenantResolveOptions>(options =>
{
options.AddDomainTenantResolver("{0}.mydomain.com"); 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. > 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 ```bash
dotnet add package Owl.TokenWildcardIssuerValidator dotnet add package Owl.TokenWildcardIssuerValidator
``` ```
Then fix the options of the `.AddJwtBearer` block Then fix the options of the `.AddJwtBearer` block
```csharp ```csharp
// using using Owl.TokenWildcardIssuerValidator; // using using Owl.TokenWildcardIssuerValidator;
context.Services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{ {
context.Services options.Authority = configuration["AuthServer:Authority"];
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
.AddJwtBearer(options => options.Audience = "ExampleProjectName";
{
options.Authority = configuration["AuthServer:Authority"]; // start of added block
options.RequireHttpsMetadata = Convert.ToBoolean( options.TokenValidationParameters.IssuerValidator = TokenWildcardIssuerValidator.IssuerValidator;
configuration["AuthServer:RequireHttpsMetadata"] options.TokenValidationParameters.ValidIssuers = new[]
); {
options.Audience = "ExampleProjectName"; "https://{0}.mydomain.com:44349/" //the port may different
};
// start of added block // end 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
});
}
``` ```

Loading…
Cancel
Save