Yes
I have applied it however, there is no progress. It is still working only for the host tenant regardless of the subdomain. Could you provide me a working sample for the separated authserver ? I want to see how ....HttpApiHostModule.cs is implemented in this regards
How can I find and override the file? It is not in my project file (framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs)
Thanks for your answer. However, I have already implemented this solution before reopening this ticket. The issue is if I use any of the below format for AuthServer:Authority
https://{0}.authserver.mystore.dev https://{{tenantName}}.authserver.mystore.dev https://{{tenantId}}.authserver.mystore.dev
Everything works for Angular + Host API + Separated Auth Server with a subdomain, except Swagger. **context.Services.AddAbpSwaggerGenWithOAuth has failed. ** How can I resolve the parsing URI issue?
Volo.Abp.AbpInitializationException: An error occurred during ConfigureServicesAsync phase of the module ImmoProv.ImmoProvHttpApiHostModule, ImmoProv.HttpApi.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
---> System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString)
at Microsoft.Extensions.DependencyInjection.AbpSwaggerGenServiceCollectionExtensions.AddAbpSwaggerGenWithOAuth(IServiceCollection services, String authority, Dictionary2 scopes, Action
1 setupAction, String authorizationEndpoint, String tokenEndpoint)
at ImmoProv.ImmoProvHttpApiHostModule.ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration) in C:\Projects\ImmoProv\aspnet-core\src\ImmoProv.HttpApi.Host\ImmoProvHttpApiHostModule.cs:line 288
at ImmoProv.ImmoProvHttpApiHostModule.ConfigureServices(ServiceConfigurationContext context) in C:\Projects\ImmoProv\aspnet-core\src\ImmoProv.HttpApi.Host\ImmoProvHttpApiHostModule.cs:line 118
at Volo.Abp.Modularity.AbpModule.ConfigureServicesAsync(ServiceConfigurationContext context)
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
--- End of inner exception stack trace ---
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action
1 optionsAction)
at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action`1 optionsAction)
at ImmoProv.Program.Main(String[] args) in C:\Projects\ImmoProv\aspnet-core\src\ImmoProv.HttpApi.Host\Program.cs:line 49
Thanks for your answer. However, I have already implemented this solution before reopening this ticket. The issue is if I use any of the below format for AuthServer:Authority
https://{0}.authserver.mystore.dev https://{{tenantName}}.authserver.mystore.dev https://{{tenantId}}.authserver.mystore.dev
Everything works for Angular + Host API + Separated Auth Server with a subdomain, except Swagger. **context.Services.AddAbpSwaggerGenWithOAuth has failed. ** How can I resolve the parsing URI issue?
Volo.Abp.AbpInitializationException: An error occurred during ConfigureServicesAsync phase of the module ImmoProv.ImmoProvHttpApiHostModule, ImmoProv.HttpApi.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
---> System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString)
at Microsoft.Extensions.DependencyInjection.AbpSwaggerGenServiceCollectionExtensions.AddAbpSwaggerGenWithOAuth(IServiceCollection services, String authority, Dictionary2 scopes, Action
1 setupAction, String authorizationEndpoint, String tokenEndpoint)
at ImmoProv.ImmoProvHttpApiHostModule.ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration) in C:\Projects\ImmoProv\aspnet-core\src\ImmoProv.HttpApi.Host\ImmoProvHttpApiHostModule.cs:line 288
at ImmoProv.ImmoProvHttpApiHostModule.ConfigureServices(ServiceConfigurationContext context) in C:\Projects\ImmoProv\aspnet-core\src\ImmoProv.HttpApi.Host\ImmoProvHttpApiHostModule.cs:line 118
at Volo.Abp.Modularity.AbpModule.ConfigureServicesAsync(ServiceConfigurationContext context)
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
--- End of inner exception stack trace ---
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action
1 optionsAction)
at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action`1 optionsAction)
at ImmoProv.Program.Main(String[] args) in C:\Projects\ImmoProv\aspnet-core\src\ImmoProv.HttpApi.Host\Program.cs:line 49
$"authority.TrimEnd('/')}{authorizationEndpoint.EnsureStartswith('/')}
Respectively authorization URL and token Url as follows;
http://{0}.authserver.immoprov.local:44319/connect/authorize
http://{0}.authserver.immoprov.local:44319/connect/token
Hi, How can Swagger's authority be set dynamically based on the subdomain like demo1.authserver.mydomain.com or demo2.authserver.mydomain.com instead of authserver.mydomain.com? Otherwise, it gets an access token always for the host regardless of tenant subdomain name(demo1, demo2).
private static void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAbpSwaggerGenWithOAuth(
** configuration["AuthServer:Authority"])!,**
new Dictionary<string, string>
{
{"DemoMultitenant", "DemoMultitenant API"}
},
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "DemoMultitenant API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
options.HideAbpEndpoints();
options.IgnoreObsoleteActions();
options.IgnoreObsoleteProperties();
});
}
Thanks
I've solved the problem for the time being. If I reencounter it, I'll reopen the ticket. But for now, please refund my ticket.