From f5101c69e6dd3cc404b7b88261a617cea6bf0bb0 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Thu, 20 Oct 2022 22:53:18 -0400 Subject: [PATCH] Added optional params for swagger auth --- .../AbpSwaggerGenServiceCollectionExtensions.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs index 5ba2d7ee09..ad35051780 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs +++ b/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 scopes, + string authorizationEndpoint = "/connect/authorize", + string tokenEndpoint = "/connect/token", Action setupAction = null) { + 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 } } });