From f5101c69e6dd3cc404b7b88261a617cea6bf0bb0 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Thu, 20 Oct 2022 22:53:18 -0400 Subject: [PATCH 1/2] 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 } } }); From e1505ab58e05206e7920c37ad66911ebe73c1a5d Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Thu, 20 Oct 2022 23:28:18 -0400 Subject: [PATCH 2/2] Fixed param order --- .../AbpSwaggerGenServiceCollectionExtensions.cs | 4 ++-- 1 file changed, 2 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 ad35051780..3c27c640cd 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs @@ -33,9 +33,9 @@ public static class AbpSwaggerGenServiceCollectionExtensions this IServiceCollection services, [NotNull] string authority, [NotNull] Dictionary scopes, + Action setupAction = null, string authorizationEndpoint = "/connect/authorize", - string tokenEndpoint = "/connect/token", - Action setupAction = null) + string tokenEndpoint = "/connect/token") { var authorizationUrl = new Uri($"{authority.TrimEnd('/')}{authorizationEndpoint.EnsureStartsWith('/')}"); var tokenUrl = new Uri($"{authority.TrimEnd('/')}{tokenEndpoint.EnsureStartsWith('/')}");