Merge branch 'develop'

This commit is contained in:
meysamhadeli 2022-11-16 22:32:29 +03:30
commit 122bd0f8d7
14 changed files with 40 additions and 79 deletions

View File

@ -8,13 +8,6 @@
} }
} }
}, },
"identity": {
"destinations": {
"destination1": {
"address": "http://identity"
}
}
},
"passenger": { "passenger": {
"destinations": { "destinations": {
"destination1": { "destination1": {

View File

@ -12,46 +12,26 @@
"identity": { "identity": {
"clusterId": "identity", "clusterId": "identity",
"match": { "match": {
"path": "{**catch-all}" "path": "/{**catch-all}"
}, }
"transforms": [
{
"pathPattern": "{**catch-all}"
}
]
}, },
"flight": { "flight": {
"clusterId": "flight", "clusterId": "flight",
"match": { "match": {
"path": "api/{version}/flight/{**catch-all}" "path": "api/{version}/flight/{**catch-all}"
}, }
"transforms": [
{
"pathPattern": "api/{version}/flight/{**catch-all}"
}
]
}, },
"passenger": { "passenger": {
"clusterId": "passenger", "clusterId": "passenger",
"match": { "match": {
"path": "api/{version}/passenger/{**catch-all}" "path": "api/{version}/passenger/{**catch-all}"
}, }
"transforms": [
{
"pathPattern": "api/{version}/passenger/{**catch-all}"
}
]
}, },
"booking": { "booking": {
"clusterId": "booking", "clusterId": "booking",
"match": { "match": {
"path": "api/{version}/booking/{**catch-all}" "path": "api/{version}/booking/{**catch-all}"
}, }
"transforms": [
{
"pathPattern": "api/{version}/booking/{**catch-all}"
}
]
} }
}, },
"clusters": { "clusters": {

View File

@ -81,22 +81,22 @@
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.MongoDb" Version="6.0.2" /> <PackageReference Include="AspNetCore.HealthChecks.MongoDb" Version="6.0.2" />
<PackageReference Include="System.Interactive.Async" Version="6.0.1" /> <PackageReference Include="System.Interactive.Async" Version="6.0.1" />
<PackageReference Include="MassTransit" Version="8.0.8" /> <PackageReference Include="MassTransit" Version="8.0.9-develop.658" />
<PackageReference Include="MassTransit.RabbitMQ" Version="8.0.8" /> <PackageReference Include="MassTransit.RabbitMQ" Version="8.0.9-develop.658" />
<PackageReference Include="DotNetCore.CAP" Version="6.2.1" /> <PackageReference Include="DotNetCore.CAP" Version="6.2.1" />
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="6.2.1" /> <PackageReference Include="DotNetCore.CAP.Dashboard" Version="6.2.1" />
<PackageReference Include="DotNetCore.CAP.MongoDB" Version="6.2.1" /> <PackageReference Include="DotNetCore.CAP.MongoDB" Version="6.2.1" />
<PackageReference Include="DotNetCore.CAP.OpenTelemetry" Version="6.2.1" /> <PackageReference Include="DotNetCore.CAP.OpenTelemetry" Version="6.2.1" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="6.2.1" /> <PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="6.2.1" />
<PackageReference Include="DotNetCore.CAP.SqlServer" Version="6.2.1" /> <PackageReference Include="DotNetCore.CAP.SqlServer" Version="6.2.1" />
<PackageReference Include="Duende.IdentityServer" Version="6.1.7" /> <PackageReference Include="Duende.IdentityServer" Version="6.2.0-rc.1" />
<PackageReference Include="Duende.IdentityServer.AspNetIdentity" Version="6.1.7" /> <PackageReference Include="Duende.IdentityServer.AspNetIdentity" Version="6.2.0-rc.1" />
<PackageReference Include="Duende.IdentityServer.EntityFramework" Version="6.1.7" /> <PackageReference Include="Duende.IdentityServer.EntityFramework" Version="6.2.0-rc.1" />
<PackageReference Include="Duende.IdentityServer.EntityFramework.Storage" Version="6.1.7" /> <PackageReference Include="Duende.IdentityServer.EntityFramework.Storage" Version="6.2.0-rc.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="Testcontainers" Version="2.2.0" /> <PackageReference Include="Testcontainers" Version="2.2.0" />
<PackageReference Include="Yarp.ReverseProxy" Version="1.1.1" /> <PackageReference Include="Yarp.ReverseProxy" Version="1.1.1" />
<PackageReference Include="Microsoft.Identity.Web" Version="1.25.5" /> <PackageReference Include="Microsoft.Identity.Web" Version="2.0.5-preview" />
<PackageReference Include="Jaeger" Version="1.0.3" /> <PackageReference Include="Jaeger" Version="1.0.3" />
<PackageReference Include="OpenTracing" Version="0.12.1" /> <PackageReference Include="OpenTracing" Version="0.12.1" />

View File

@ -34,26 +34,6 @@ public static class ServiceCollectionExtensions
var xmlFile = XmlCommentsFilePath(assembly); var xmlFile = XmlCommentsFilePath(assembly);
if (File.Exists(xmlFile)) options.IncludeXmlComments(xmlFile); if (File.Exists(xmlFile)) options.IncludeXmlComments(xmlFile);
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = @"JWT Authorization header using the Bearer scheme. \r\n\r\n
Enter 'Bearer' [space] and then your token in the text input below.
\r\n\r\nExample: 'Bearer 12345abcdef'",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey,
Scheme = "Bearer"
});
options.AddSecurityDefinition(
HeaderName,
new OpenApiSecurityScheme
{
Description = "Api key needed to access the endpoints. X-Api-Key: My_API_Key",
In = ParameterLocation.Header,
Name = HeaderName,
Type = SecuritySchemeType.ApiKey
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement options.AddSecurityRequirement(new OpenApiSecurityRequirement
{ {
@ -66,19 +46,6 @@ public static class ServiceCollectionExtensions
In = ParameterLocation.Header In = ParameterLocation.Header
}, },
new List<string>() new List<string>()
},
{
new OpenApiSecurityScheme
{
Name = HeaderName,
Type = SecuritySchemeType.ApiKey,
In = ParameterLocation.Header,
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme, Id = HeaderName
}
},
Array.Empty<string>()
} }
}); });

View File

@ -12,6 +12,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -5,7 +5,7 @@ namespace Flight.Aircrafts.Features.CreateAircraft.Exceptions;
public class AircraftAlreadyExistException : AppException public class AircraftAlreadyExistException : AppException
{ {
public AircraftAlreadyExistException() : base("Flight already exist!", HttpStatusCode.Conflict) public AircraftAlreadyExistException() : base("Aircraft already exist!", HttpStatusCode.Conflict)
{ {
} }
} }

View File

@ -12,6 +12,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -15,7 +15,6 @@ using Identity;
using Identity.Data; using Identity.Data;
using Identity.Data.Seed; using Identity.Data.Seed;
using Identity.Extensions; using Identity.Extensions;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Prometheus; using Prometheus;
using Serilog; using Serilog;

View File

@ -11,6 +11,10 @@
"UserName": "guest", "UserName": "guest",
"Password": "guest" "Password": "guest"
}, },
"Jwt": {
"Authority": "https://localhost:5005",
"Audience": "identity-api"
},
"LogOptions": { "LogOptions": {
"Level": "information", "Level": "information",
"LogTemplate": "{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}", "LogTemplate": "{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}",

View File

@ -24,7 +24,8 @@ public static class Config
{ {
new(Constants.StandardScopes.FlightApi), new(Constants.StandardScopes.FlightApi),
new(Constants.StandardScopes.PassengerApi), new(Constants.StandardScopes.PassengerApi),
new(Constants.StandardScopes.BookingApi) new(Constants.StandardScopes.BookingApi),
new(Constants.StandardScopes.IdentityApi)
}; };
@ -33,7 +34,8 @@ public static class Config
{ {
new(Constants.StandardScopes.FlightApi), new(Constants.StandardScopes.FlightApi),
new(Constants.StandardScopes.PassengerApi), new(Constants.StandardScopes.PassengerApi),
new(Constants.StandardScopes.BookingApi) new(Constants.StandardScopes.BookingApi),
new(Constants.StandardScopes.IdentityApi)
}; };
public static IEnumerable<Client> Clients => public static IEnumerable<Client> Clients =>
@ -56,7 +58,8 @@ public static class Config
IdentityServerConstants.StandardScopes.Profile, IdentityServerConstants.StandardScopes.Profile,
Constants.StandardScopes.FlightApi, Constants.StandardScopes.FlightApi,
Constants.StandardScopes.PassengerApi, Constants.StandardScopes.PassengerApi,
Constants.StandardScopes.BookingApi Constants.StandardScopes.BookingApi,
new(Constants.StandardScopes.IdentityApi)
} }
} }
}; };

View File

@ -14,5 +14,6 @@ public static class Constants
public const string FlightApi = "flight-api"; public const string FlightApi = "flight-api";
public const string PassengerApi = "passenger-api"; public const string PassengerApi = "passenger-api";
public const string BookingApi = "booking-api"; public const string BookingApi = "booking-api";
public const string IdentityApi = "identity-api";
} }
} }

View File

@ -6,7 +6,6 @@ using Identity.Identity.Features.RegisterNewUser.Commands.V1;
using MediatR; using MediatR;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
@ -17,7 +16,6 @@ public class RegisterNewUserEndpoint : IMinimalEndpoint
public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder endpoints) public IEndpointRouteBuilder MapEndpoint(IEndpointRouteBuilder endpoints)
{ {
endpoints.MapPost($"{EndpointConfig.BaseApiPath}/identity/register-user", RegisterNewUser) endpoints.MapPost($"{EndpointConfig.BaseApiPath}/identity/register-user", RegisterNewUser)
.RequireAuthorization()
.WithTags("Identity") .WithTags("Identity")
.WithName("Register User") .WithName("Register User")
.WithMetadata(new SwaggerOperationAttribute("Register User", "Register User")) .WithMetadata(new SwaggerOperationAttribute("Register User", "Register User"))

View File

@ -12,6 +12,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -12,6 +12,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>