This commit is contained in:
2022-04-09 19:53:41 +01:00
parent 1befc2e053
commit a2d91e072f
21 changed files with 663 additions and 0 deletions

View File

@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Authorization;
using Unleash;
using Microsoft.Extensions.Options;
using isnd.Helpers;
using Microsoft.IdentityModel.Tokens;
namespace isnd
{
@ -64,6 +65,7 @@ namespace isnd
policy.Requirements.Add(new ValidApiKeyRequirement()));
})
.AddTransient<IMailer, EmailSender>()
.AddTransient<IEmailSender, EmailSender>()
.AddTransient<IPackageManager, PackageManager>()
@ -80,6 +82,17 @@ namespace isnd
return s.GetRequiredService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().CreateUnleahClient(config.Value);
});
services.AddAuthentication("Bearer")
.AddJwtBearer("Bearer", options =>
{
options.Authority = "https://localhost:5001";
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateAudience = false
};
});
}