From d2f24b41263ca676386ecaf5a96ff9bc4dcad25c Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Wed, 9 Aug 2023 23:24:29 -0400 Subject: [PATCH] Added oidc flows and updated discovery endpoint --- .../AbpSwaggerGenServiceCollectionExtensions.cs | 5 +++-- .../Volo/Abp/Swashbuckle/AbpOidcFlows.cs | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpOidcFlows.cs 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 13f1f2a296..0acdf852e5 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs @@ -5,6 +5,7 @@ using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.SwaggerGen; using Swashbuckle.AspNetCore.SwaggerUI; using Volo.Abp.Content; +using Volo.Abp.Swashbuckle; namespace Microsoft.Extensions.DependencyInjection; @@ -88,10 +89,10 @@ public static class AbpSwaggerGenServiceCollectionExtensions Action? setupAction = null) { var discoveryUrl = discoveryEndpoint != null ? - new Uri(discoveryEndpoint) : + new Uri($"{discoveryEndpoint.TrimEnd('/')}/.well-known/openid-configuration") : new Uri($"{authority.TrimEnd('/')}/.well-known/openid-configuration"); - flows ??= new [] { "authorization_code" }; + flows ??= new [] { AbpSwaggerOidcFlows.AuthorizationCode }; services.Configure(swaggerUiOptions => { diff --git a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpOidcFlows.cs b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpOidcFlows.cs new file mode 100644 index 0000000000..cbc30c5f29 --- /dev/null +++ b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpOidcFlows.cs @@ -0,0 +1,9 @@ +namespace Volo.Abp.Swashbuckle; + +public static class AbpSwaggerOidcFlows +{ + public const string AuthorizationCode = "authorization_code"; + public const string Implicit = "implicit"; + public const string Password = "password"; + public const string ClientCredentials = "client_credentials"; +} \ No newline at end of file