Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
rahiyansafin committed May 17, 2023
1 parent d56998d commit 55bdae0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions HR.LeaveManagement.API/HR.LeaveManagement.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.5" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.30.1" />
<PackageReference Include="Microsoft.OpenApi" Version="1.6.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.6" />
</ItemGroup>

<ItemGroup>
Expand Down
17 changes: 15 additions & 2 deletions HR.LeaveManagement.API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
using HR.LeaveManagement.Infrastructure;
using HR.LeaveManagement.Persistence;

using Microsoft.OpenApi.Models;

using Serilog;

using Swashbuckle.AspNetCore.Filters;

var builder = WebApplication.CreateBuilder(args);
// Add services to the container.

Expand All @@ -31,8 +35,17 @@

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

builder.Services.AddSwaggerGen(c =>
{
c.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Description = """Standard Authorization header using the Bearer scheme. Example: "bearer {token}" """,
In = ParameterLocation.Header,
Name = "Authorization",
Type = SecuritySchemeType.ApiKey
});
c.OperationFilter<SecurityRequirementsOperationFilter>();
});
var app = builder.Build();

app.UseMiddleware<ExceptionMiddleware>();
Expand Down
2 changes: 1 addition & 1 deletion HR.LeaveManagement.API/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"FromName": "HR Management System"
},
"JwtSettings": {
"Key": "SECRET_JWT_KEY_HERE",
"Key": "this is my custom Secret key for authentication",
"Issuer": "HRLeavemanagement.Api",
"Audience": "HRLeavemanagementUser",
"DurationInMinutes": 15
Expand Down

0 comments on commit 55bdae0

Please sign in to comment.