Browse Source
Merge pull request #11688 from abpframework/EngincanV/issue-11677
Docs: Add Hide ABP Endpoints Section to Swagger Integration Docs
pull/11797/head
albert
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
19 additions and
3 deletions
-
docs/en/API/Swagger-Integration.md
-
framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs
|
|
|
@ -48,9 +48,9 @@ First, we need to use `AddAbpSwaggerGen` extension to configure Swagger in `Conf |
|
|
|
```csharp |
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var services = contex.Services; |
|
|
|
var services = context.Services; |
|
|
|
|
|
|
|
//... other configarations. |
|
|
|
//... other configurations. |
|
|
|
|
|
|
|
services.AddAbpSwaggerGen( |
|
|
|
options => |
|
|
|
@ -81,6 +81,22 @@ public override void OnApplicationInitialization(ApplicationInitializationContex |
|
|
|
} |
|
|
|
``` |
|
|
|
|
|
|
|
### Hide ABP Endpoints on Swagger UI |
|
|
|
|
|
|
|
If you want to hide ABP's default endpoints, call the `HideAbpEndpoints` method in your Swagger configuration as shown in the following example: |
|
|
|
|
|
|
|
```csharp |
|
|
|
services.AddAbpSwaggerGen( |
|
|
|
options => |
|
|
|
{ |
|
|
|
//... other options |
|
|
|
|
|
|
|
//Hides ABP Related endpoints on Swagger UI |
|
|
|
options.HideAbpEndpoints(); |
|
|
|
} |
|
|
|
) |
|
|
|
``` |
|
|
|
|
|
|
|
## Using Swagger with OAUTH |
|
|
|
|
|
|
|
For non MVC/Tiered applications, we need to configure Swagger with OAUTH to handle authorization. |
|
|
|
|
|
|
|
@ -8,7 +8,7 @@ namespace Volo.Abp.Swashbuckle; |
|
|
|
|
|
|
|
public class AbpSwashbuckleDocumentFilter : IDocumentFilter |
|
|
|
{ |
|
|
|
protected string[] ActionUrlPrefixes = new[] {"Volo.Abp"}; |
|
|
|
protected string[] ActionUrlPrefixes = new[] {"Volo."}; |
|
|
|
|
|
|
|
public virtual void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) |
|
|
|
{ |
|
|
|
|