app & swagger fixes

master
Tudor Stanciu 2020-12-20 11:28:25 +02:00
parent 182d17c73c
commit 5b2b5bbab9
4 changed files with 11 additions and 50 deletions

View File

@ -1,26 +1,7 @@
{ {
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53730",
"sslPort": 0
}
},
"profiles": { "profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IdentityServer.Api": { "IdentityServer.Api": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"applicationUrl": "http://localhost:5000", "applicationUrl": "http://localhost:5000",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"

View File

@ -12,6 +12,14 @@ namespace IdentityServer.Api.Swagger
{ {
const string paramCaptureGroup = "param"; const string paramCaptureGroup = "param";
foreach (var parameter in operation.Parameters.ToList())
{
if (parameter.Name.ToLowerInvariant().StartsWith("metadata"))
{
operation.Parameters.Remove(parameter);
}
}
var openApiPathParameters = operation.Parameters.Where(param => param.In == ParameterLocation.Path).ToList(); var openApiPathParameters = operation.Parameters.Where(param => param.In == ParameterLocation.Path).ToList();
var pathParamRegEx = $@"\{{(?<{paramCaptureGroup}>[^\}}]+)\}}"; var pathParamRegEx = $@"\{{(?<{paramCaptureGroup}>[^\}}]+)\}}";

View File

@ -16,38 +16,10 @@ namespace IdentityServer.Api.Swagger
c.SwaggerDoc("v1", c.SwaggerDoc("v1",
new OpenApiInfo new OpenApiInfo
{ {
Title = "NetworkResurrector API", Title = "Identity Server API",
Version = "v1" Version = "v1"
}); });
c.AddSecurityDefinition("Basic",
new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = @"JWT Authorization header using the Basic scheme. Enter 'Basic' [space] and then your token in the text input below. Example: 'Basic 12345abcdef'",
Name = "Authorization",
Scheme = "Basic",
Type = SecuritySchemeType.ApiKey
});
c.AddSecurityRequirement(new OpenApiSecurityRequirement()
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "Basic"
},
Scheme = "Basic",
Name = "Authorization",
In = ParameterLocation.Header
},
new List<string>()
}
});
c.OperationFilter<PathParamsOperationFilter>(); c.OperationFilter<PathParamsOperationFilter>();
c.SchemaFilter<DtoSchemaFilter>(); c.SchemaFilter<DtoSchemaFilter>();
c.CustomSchemaIds(type => type.ToString()); c.CustomSchemaIds(type => type.ToString());
@ -74,7 +46,7 @@ namespace IdentityServer.Api.Swagger
applicationBuilder.UseSwaggerUI(c => applicationBuilder.UseSwaggerUI(c =>
{ {
c.SwaggerEndpoint("v1/swagger.json", "Chatbot API"); c.SwaggerEndpoint("v1/swagger.json", "IdentityServer API");
c.RoutePrefix = $"swagger"; c.RoutePrefix = $"swagger";
}); });

View File

@ -1,5 +1,5 @@
{ {
"urls": "http://*:5062", "urls": "http://*:5063",
"ConnectionStrings": { "ConnectionStrings": {
"DatabaseConnection": "Server=***REMOVED***;Database=IdentityServer_dev;User Id=sa;Password=***REMOVED***;MultipleActiveResultSets=true" "DatabaseConnection": "Server=***REMOVED***;Database=IdentityServer_dev;User Id=sa;Password=***REMOVED***;MultipleActiveResultSets=true"
}, },