1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 00:22:50 -05:00

Add Swagger generation for Identity (#2058)

This commit is contained in:
Oscar Hinton
2022-07-04 12:05:46 +02:00
committed by GitHub
parent 1a89056c61
commit 113627dcd5
25 changed files with 212 additions and 176 deletions

View File

@ -3141,7 +3141,7 @@
"commcore": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1"
"Core": "2022.5.2"
}
},
"core": {
@ -3185,7 +3185,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3194,7 +3194,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "11.0.0",
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.EntityFrameworkCore.Relational": "6.0.4",
"Npgsql.EntityFrameworkCore.PostgreSQL": "6.0.4",
"Pomelo.EntityFrameworkCore.MySql": "6.0.1",
@ -3204,7 +3204,7 @@
"migrator": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.Extensions.Logging": "6.0.0",
"dbup-sqlserver": "4.5.0"
}
@ -3212,9 +3212,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Infrastructure.Dapper": "2022.5.1",
"Infrastructure.EntityFramework": "2022.5.1"
"Core": "2022.5.2",
"Infrastructure.Dapper": "2022.5.2",
"Infrastructure.EntityFramework": "2022.5.2"
}
}
}

View File

@ -202,7 +202,7 @@ namespace Bit.Api.Controllers
}
public async Task<bool> CanCreateCollection(Guid orgId, Guid collectionId)
private async Task<bool> CanCreateCollection(Guid orgId, Guid collectionId)
{
if (collectionId != default)
{

View File

@ -2636,7 +2636,7 @@
"commcore": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1"
"Core": "2022.5.2"
}
},
"core": {
@ -2680,7 +2680,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -2689,7 +2689,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "11.0.0",
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.EntityFrameworkCore.Relational": "6.0.4",
"Npgsql.EntityFrameworkCore.PostgreSQL": "6.0.4",
"Pomelo.EntityFrameworkCore.MySql": "6.0.1",
@ -2699,9 +2699,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Infrastructure.Dapper": "2022.5.1",
"Infrastructure.EntityFramework": "2022.5.1"
"Core": "2022.5.2",
"Infrastructure.Dapper": "2022.5.2",
"Infrastructure.EntityFramework": "2022.5.2"
}
}
}

View File

@ -3156,7 +3156,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3165,7 +3165,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "11.0.0",
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.EntityFrameworkCore.Relational": "6.0.4",
"Npgsql.EntityFrameworkCore.PostgreSQL": "6.0.4",
"Pomelo.EntityFrameworkCore.MySql": "6.0.1",
@ -3175,9 +3175,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Infrastructure.Dapper": "2022.5.1",
"Infrastructure.EntityFramework": "2022.5.1"
"Core": "2022.5.2",
"Infrastructure.Dapper": "2022.5.2",
"Infrastructure.EntityFramework": "2022.5.2"
}
}
}

View File

@ -2620,7 +2620,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -2629,7 +2629,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "11.0.0",
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.EntityFrameworkCore.Relational": "6.0.4",
"Npgsql.EntityFrameworkCore.PostgreSQL": "6.0.4",
"Pomelo.EntityFrameworkCore.MySql": "6.0.1",
@ -2639,9 +2639,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Infrastructure.Dapper": "2022.5.1",
"Infrastructure.EntityFramework": "2022.5.1"
"Core": "2022.5.2",
"Infrastructure.Dapper": "2022.5.2",
"Infrastructure.EntityFramework": "2022.5.2"
}
}
}

View File

@ -2620,7 +2620,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -2629,7 +2629,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "11.0.0",
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.EntityFrameworkCore.Relational": "6.0.4",
"Npgsql.EntityFrameworkCore.PostgreSQL": "6.0.4",
"Pomelo.EntityFrameworkCore.MySql": "6.0.1",
@ -2639,9 +2639,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Infrastructure.Dapper": "2022.5.1",
"Infrastructure.EntityFramework": "2022.5.1"
"Core": "2022.5.2",
"Infrastructure.Dapper": "2022.5.2",
"Infrastructure.EntityFramework": "2022.5.2"
}
}
}

View File

@ -2638,7 +2638,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -2647,7 +2647,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "11.0.0",
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.EntityFrameworkCore.Relational": "6.0.4",
"Npgsql.EntityFrameworkCore.PostgreSQL": "6.0.4",
"Pomelo.EntityFrameworkCore.MySql": "6.0.1",
@ -2657,9 +2657,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Infrastructure.Dapper": "2022.5.1",
"Infrastructure.EntityFramework": "2022.5.1"
"Core": "2022.5.2",
"Infrastructure.Dapper": "2022.5.2",
"Infrastructure.EntityFramework": "2022.5.2"
}
}
}

View File

@ -10,4 +10,8 @@
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.3.1" />
</ItemGroup>
</Project>

View File

@ -10,6 +10,7 @@ using Bit.Identity.Utilities;
using Bit.SharedWeb.Utilities;
using IdentityServer4.Extensions;
using Microsoft.IdentityModel.Logging;
using Microsoft.OpenApi.Models;
namespace Bit.Identity
{
@ -60,6 +61,11 @@ namespace Bit.Identity
config.Filters.Add(new ModelStateValidationFilterAttribute());
});
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Bitwarden Identity", Version = "v1" });
});
if (!globalSettings.SelfHosted)
{
// Rate limiting
@ -188,6 +194,7 @@ namespace Bit.Identity
if (env.IsDevelopment())
{
app.UseSwagger();
app.UseDeveloperExceptionPage();
app.UseCookiePolicy();
}

View File

@ -2,6 +2,15 @@
"version": 1,
"dependencies": {
"net6.0": {
"Swashbuckle.AspNetCore.SwaggerGen": {
"type": "Direct",
"requested": "[6.3.1, )",
"resolved": "6.3.1",
"contentHash": "+uoBV4h/6NhCPLoTofSmuOnZ+usu4PW1jP6l4OHwPyu2frbYXGNpJsHs5uUXXn929OiVQkT8wo3Lj/o+P99Ejg==",
"dependencies": {
"Swashbuckle.AspNetCore.Swagger": "6.3.1"
}
},
"AspNetCoreRateLimit": {
"type": "Transitive",
"resolved": "4.0.2",
@ -758,6 +767,11 @@
"resolved": "7.6.4",
"contentHash": "MSSmA6kIfpgFTtNpOnnayoSj/6KSzHC1U9KOjF7cTA1PG4tZ7rIMi1pvjFc8CmYEvP4cxGl/+vrCn+HpK26HTQ=="
},
"Microsoft.OpenApi": {
"type": "Transitive",
"resolved": "1.2.3",
"contentHash": "Nug3rO+7Kl5/SBAadzSMAVgqDlfGjJZ0GenQrLywJ84XGKO0uRqkunz5Wyl0SDwcR71bAATXvSdbdzPrYRYKGw=="
},
"Microsoft.Spatial": {
"type": "Transitive",
"resolved": "7.6.4",
@ -1271,6 +1285,14 @@
"System.Configuration.ConfigurationManager": "6.0.0"
}
},
"Swashbuckle.AspNetCore.Swagger": {
"type": "Transitive",
"resolved": "6.3.1",
"contentHash": "idAFh4xhyJHYHfdLVOOn+BmscBul1OQbWsnL6YPJE8tO/0y6S79hDCvs6OY5VI093/9+1pYY3j31Zet9yaDZjA==",
"dependencies": {
"Microsoft.OpenApi": "1.2.3"
}
},
"System.AppContext": {
"type": "Transitive",
"resolved": "4.3.0",
@ -2620,7 +2642,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -2629,7 +2651,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "11.0.0",
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.EntityFrameworkCore.Relational": "6.0.4",
"Npgsql.EntityFrameworkCore.PostgreSQL": "6.0.4",
"Pomelo.EntityFrameworkCore.MySql": "6.0.1",
@ -2639,9 +2661,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Infrastructure.Dapper": "2022.5.1",
"Infrastructure.EntityFramework": "2022.5.1"
"Core": "2022.5.2",
"Infrastructure.Dapper": "2022.5.2",
"Infrastructure.EntityFramework": "2022.5.2"
}
}
}

View File

@ -2703,7 +2703,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -2712,7 +2712,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "11.0.0",
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.EntityFrameworkCore.Relational": "6.0.4",
"Npgsql.EntityFrameworkCore.PostgreSQL": "6.0.4",
"Pomelo.EntityFrameworkCore.MySql": "6.0.1",
@ -2722,9 +2722,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Infrastructure.Dapper": "2022.5.1",
"Infrastructure.EntityFramework": "2022.5.1"
"Core": "2022.5.2",
"Infrastructure.Dapper": "2022.5.2",
"Infrastructure.EntityFramework": "2022.5.2"
}
}
}

View File

@ -2620,7 +2620,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "2022.5.1",
"Core": "2022.5.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -2629,7 +2629,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "11.0.0",
"Core": "2022.5.1",
"Core": "2022.5.2",
"Microsoft.EntityFrameworkCore.Relational": "6.0.4",
"Npgsql.EntityFrameworkCore.PostgreSQL": "6.0.4",
"Pomelo.EntityFrameworkCore.MySql": "6.0.1",