Browse Source
Merge pull request #14409 from abpframework/gterdem/swagger_auth_fix
SwaggerAuth endpoints should be configurable
pull/14427/head
Halil İbrahim Kalkan
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
3 deletions
-
framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs
|
|
|
@ -33,8 +33,13 @@ public static class AbpSwaggerGenServiceCollectionExtensions |
|
|
|
this IServiceCollection services, |
|
|
|
[NotNull] string authority, |
|
|
|
[NotNull] Dictionary<string, string> scopes, |
|
|
|
Action<SwaggerGenOptions> setupAction = null) |
|
|
|
Action<SwaggerGenOptions> setupAction = null, |
|
|
|
string authorizationEndpoint = "/connect/authorize", |
|
|
|
string tokenEndpoint = "/connect/token") |
|
|
|
{ |
|
|
|
var authorizationUrl = new Uri($"{authority.TrimEnd('/')}{authorizationEndpoint.EnsureStartsWith('/')}"); |
|
|
|
var tokenUrl = new Uri($"{authority.TrimEnd('/')}{tokenEndpoint.EnsureStartsWith('/')}"); |
|
|
|
|
|
|
|
return services |
|
|
|
.AddAbpSwaggerGen() |
|
|
|
.AddSwaggerGen( |
|
|
|
@ -47,9 +52,9 @@ public static class AbpSwaggerGenServiceCollectionExtensions |
|
|
|
{ |
|
|
|
AuthorizationCode = new OpenApiOAuthFlow |
|
|
|
{ |
|
|
|
AuthorizationUrl = new Uri($"{authority.EnsureEndsWith('/')}connect/authorize"), |
|
|
|
AuthorizationUrl = authorizationUrl, |
|
|
|
Scopes = scopes, |
|
|
|
TokenUrl = new Uri($"{authority.EnsureEndsWith('/')}connect/token") |
|
|
|
TokenUrl = tokenUrl |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|