Skip to content

Commit 4ea4234

Browse files
authored
Removed Swagger (#25)
* some changes to fix nuget issues Removed swagger usage * web folder fixed * fixed managementConsole project * upgraded/added newtonsoft json * .sdk solution fixed * fixed pipeline * added libssl * fixed service projecrt build errors
1 parent b2f0b99 commit 4ea4234

18 files changed

Lines changed: 61 additions & 91 deletions

azure-pipelines.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,25 @@ jobs:
1010
BuildConfiguration: 'Release'
1111
BuildPlatform: 'any cpu'
1212
steps:
13+
- script: |
14+
sudo apt-get update
15+
sudo apt-get install -y libssl1.1 libssl-dev
16+
displayName: 'Install libssl dependencies'
1317
- task: NuGetToolInstaller@1
14-
displayName: Install NuGet 5.5.0
18+
displayName: Install NuGet 6.x
1519
inputs:
16-
versionSpec: '5.5.0'
20+
versionSpec: '6.x'
1721
checkLatest: true
1822
- task: UseDotNet@2
19-
displayName: Use .NET Core 5.0.x
23+
displayName: Use .NET 6.0.x
2024
inputs:
2125
packageType: 'sdk'
22-
version: '5.0.x'
23-
- task: NuGetCommand@2
26+
version: '6.0.x'
27+
- task: DotNetCoreCLI@2
2428
displayName: Restore Solution
2529
inputs:
2630
command: 'restore'
27-
restoreSolution: 'src/sdk/Microsoft.UnifiedRedisPlatform.SDK.sln'
31+
projects: 'src/sdk/Microsoft.UnifiedRedisPlatform.SDK.sln'
2832
- task: DotNetCoreCLI@2
2933
displayName: Build Library Projects
3034
inputs:
@@ -35,25 +39,29 @@ jobs:
3539
displayName: Build Service
3640
pool:
3741
vmImage: ubuntu-latest
38-
variables:
42+
variables:
3943
BuildConfiguration: 'Release'
4044
BuildPlatform: 'any cpu'
4145
steps:
46+
- script: |
47+
sudo apt-get update
48+
sudo apt-get install -y libssl1.1 libssl-dev
49+
displayName: 'Install libssl dependencies'
4250
- task: NuGetToolInstaller@1
43-
displayName: Install NuGet 5.5.0
51+
displayName: Install NuGet 6.x
4452
inputs:
45-
versionSpec: '5.5.0'
53+
versionSpec: '6.x'
4654
checkLatest: true
4755
- task: UseDotNet@2
48-
displayName: Use .NET Core 3.1.x
56+
displayName: Use .NET 6.0.x
4957
inputs:
5058
packageType: 'sdk'
51-
version: '3.1.x'
52-
- task: NuGetCommand@2
59+
version: '6.0.x'
60+
- task: DotNetCoreCLI@2
5361
displayName: Restore Solution
5462
inputs:
5563
command: 'restore'
56-
restoreSolution: 'src/service/Microsoft.UnifiedRedisPlatform.Service/Microsoft.UnifiedRedisPlatform.Service.sln'
64+
projects: 'src/service/Microsoft.UnifiedRedisPlatform.Service/Microsoft.UnifiedRedisPlatform.Service.sln'
5765
- task: DotNetCoreCLI@2
5866
displayName: Build Library Projects
5967
inputs:

src/manager/Microsoft.UnifiedRedisPlatform.Manager/Console/Microsoft.UnifiedRedisPlatform.ManagementConsole.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<ProjectReference Include="..\..\..\sdk\Microsoft.UnifiedRedisPlatform.SDK\Core\Microsoft.UnifiedRedisPlatform.Core.csproj" />
15+
<ProjectReference Include="../../../sdk/Core/Microsoft.UnifiedRedisPlatform.Core.csproj" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/manager/Microsoft.UnifiedRedisPlatform.Manager/Core/Domain/Microsoft.UnifiedRedisPlatform.Manager.Domain.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.CQRS" Version="1.0.1" />
8+
<PackageReference Include="CQRS.Mediatr.Lite" Version="1.0.0" />
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<ProjectReference Include="..\..\..\..\sdk\Microsoft.UnifiedRedisPlatform.SDK\Core\Microsoft.UnifiedRedisPlatform.Core.csproj" />
1312
<ProjectReference Include="..\..\..\..\service\Microsoft.UnifiedRedisPlatform.Service\SharedKernel\Common\Microsoft.UnifiedPlatform.Service.Common.csproj" />
1413
</ItemGroup>
1514

src/manager/Microsoft.UnifiedRedisPlatform.Manager/Web/API/Microsoft.UnifiedRedisPlatform.Manager.API.csproj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
14-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.3" />
15-
<PackageReference Include="Microsoft.CQRS" Version="1.0.1" />
16-
<PackageReference Include="Microsoft.FXP.Telemetry" Version="1.0.0-beta.1" />
14+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.32" />
1715
<PackageReference Include="Microsoft.FXP.Telemetry.Web.Extension" Version="1.0.0-beta.1" />
1816
<PackageReference Include="Microsoft.Graph" Version="3.4.0" />
1917
<PackageReference Include="Microsoft.Graph.Auth" Version="1.0.0-preview.4" />
20-
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.8" />
21-
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
18+
<PackageReference Include="Microsoft.Identity.Client" Version="4.73.1" />
19+
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.5.1" />
2220
</ItemGroup>
2321

2422
<ItemGroup>

src/manager/Microsoft.UnifiedRedisPlatform.Manager/Web/API/Startup.cs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Autofac;
33
using System.IO;
44
using System.Reflection;
5-
using Microsoft.OpenApi.Models;
65
using Microsoft.AspNetCore.Builder;
76
using Microsoft.AspNetCore.Hosting;
87
using Microsoft.Extensions.Hosting;
@@ -32,7 +31,6 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
3231
{
3332
AddAuthentication(services);
3433
AddTelemetry(services, Configuration);
35-
AddSwaggerDocumentation(services);
3634
services.AddControllers();
3735
RegisterDependencies(services, Configuration);
3836
return new AutofacServiceProvider(ApplicationContainer);
@@ -41,12 +39,6 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
4139
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
4240
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
4341
{
44-
app.UseSwagger();
45-
app.UseSwaggerUI(c =>
46-
{
47-
c.SwaggerEndpoint("/swagger/2020-5-1-beta/swagger.json", "Unified Redis Platform Administration API");
48-
c.RoutePrefix = string.Empty;
49-
});
5042
if (env.IsDevelopment())
5143
{
5244
app.UseDeveloperExceptionPage();
@@ -91,34 +83,5 @@ protected virtual void RegisterDependencies(IServiceCollection services, IConfig
9183
containerBuilder.Populate(services);
9284
ApplicationContainer = containerBuilder.Build();
9385
}
94-
95-
protected virtual void AddSwaggerDocumentation(IServiceCollection services)
96-
{
97-
services.AddSwaggerGen(c =>
98-
{
99-
c.SwaggerDoc("2020-5-1-beta", new OpenApiInfo
100-
{
101-
Title = "Unifed Redis Platform Administration API",
102-
Version = "2020-5-1-beta",
103-
Description = "APIs for managing registered applications by partners' Admins",
104-
Contact = new OpenApiContact
105-
{
106-
Name = "Field Experience Engineering Team",
107-
Email = "fxpswe@microsoft.com"
108-
}
109-
});
110-
111-
try
112-
{
113-
var documentationFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
114-
var documentationPath = Path.Combine(AppContext.BaseDirectory, documentationFile);
115-
c.IncludeXmlComments(documentationPath);
116-
}
117-
catch
118-
{
119-
// DO-Nothing if XML documentation fails
120-
}
121-
});
122-
}
12386
}
12487
}

src/manager/Microsoft.UnifiedRedisPlatform.Manager/Web/App/Microsoft.UnifiedRedisPlatform.Manager.App.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="3.1.3" />
10+
<PackageReference Include="Microsoft.Identity.Web.UI" Version="1.25.10" />
11+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1112
</ItemGroup>
1213

1314
</Project>

src/manager/Microsoft.UnifiedRedisPlatform.Manager/Web/App/Startup.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Linq;
44
using System.Threading.Tasks;
55
using Microsoft.AspNetCore.Authentication;
6-
using Microsoft.AspNetCore.Authentication.AzureAD.UI;
76
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
87
using Microsoft.AspNetCore.Authorization;
98
using Microsoft.AspNetCore.Builder;
@@ -14,6 +13,8 @@
1413
using Microsoft.Extensions.Configuration;
1514
using Microsoft.Extensions.DependencyInjection;
1615
using Microsoft.Extensions.Hosting;
16+
using Microsoft.Identity.Web;
17+
using Microsoft.Identity.Web.UI;
1718
using Microsoft.UnifiedRedisPlatform.Manager.App.Data;
1819

1920
namespace Microsoft.UnifiedRedisPlatform.Manager.App
@@ -31,18 +32,17 @@ public Startup(IConfiguration configuration)
3132
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
3233
public void ConfigureServices(IServiceCollection services)
3334
{
34-
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
35-
.AddAzureAD(options => Configuration.Bind("AzureAd", options));
36-
37-
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
38-
{
39-
options.ResponseType = "code";
40-
options.SaveTokens = true;
41-
options.Scope.Add("user_impersonation");
42-
options.ClientId = "6f40053e-5319-40e5-a90b-6f714506d96d";
43-
options.ClientSecret = "KEY_VAULT";
44-
options.Resource = "6f40053e-5319-40e5-a90b-6f714506d96d";
45-
});
35+
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
36+
.AddMicrosoftIdentityWebApp(options =>
37+
{
38+
Configuration.Bind("AzureAd", options);
39+
options.ResponseType = "code";
40+
options.SaveTokens = true;
41+
options.Scope.Add("user_impersonation");
42+
options.ClientId = "6f40053e-5319-40e5-a90b-6f714506d96d";
43+
options.ClientSecret = "KEY_VAULT";
44+
options.Resource = "6f40053e-5319-40e5-a90b-6f714506d96d";
45+
});
4646

4747
services.AddHttpClient();
4848
services.AddScoped<TokenProvider>();

src/sdk/Core/Microsoft.UnifiedRedisPlatform.Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
22-
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
21+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
22+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
2323
<PackageReference Include="StackExchange.Redis" Version="2.2.4" />
2424
</ItemGroup>
2525

src/sdk/Extensions/Microsoft.Extensions.Caching.UnifiedRedisPlatform/Microsoft.Extensions.Caching.UnifiedRedisPlatform.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
1819
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.1.3" />
1920
<PackageReference Include="Microsoft.Extensions.Options" Version="3.1.3" />
21+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
2022
<PackageReference Include="UnifiedRedisPlatform" Version="1.0.2" />
2123
</ItemGroup>
2224

src/service/Microsoft.UnifiedRedisPlatform.Service/Core/Application/Commands/Handlers/LogClientInfoCommandHandler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System.Collections.Concurrent;
88
using AppInsights.EnterpriseTelemetry.Context;
99
using Microsoft.UnifiedPlatform.Service.Common.Models;
10-
using AppInsights.EnterpriseTelemetry.Context;
1110

1211
namespace Microsoft.UnifiedPlatform.Service.Application.Commands.Handlers
1312
{

0 commit comments

Comments
 (0)