Расширил жизнь bearer токена
All checks were successful
Lint / Run linters (push) Successful in 52s
Build and deploy / Publish image (push) Successful in 38s
Build and deploy / Deploy image (push) Successful in 11s

This commit is contained in:
Sergey Karmanov 2024-06-21 13:37:13 +03:00
parent 7d4edb6caa
commit 25fc0701e1

View File

@ -3,6 +3,8 @@ using HackathonPreparing.ApiService.Features.AuthFeature.EfCore;
using HackathonPreparing.ApiService.Features.DevFeature;
using HackathonPreparing.ApiService.Features.WeatherForecastFeature;
using HackathonPreparing.ApiService.Features.WeatherForecastFeature.EfCore;
using Microsoft.AspNetCore.Authentication.BearerToken;
using Microsoft.AspNetCore.Identity;
// using HackathonPreparing.ServiceDefaults;
using Microsoft.OpenApi.Models;
@ -40,11 +42,14 @@ builder.Services.AddSwaggerGen(c =>
builder.Services.AddAuthorization();
builder.Services.AddAuthentication().AddBearerToken();
builder.Services
.AddIdentityApiEndpoints<User>()
.AddEntityFrameworkStores<UserContext>();
builder.Services.AddOptions<BearerTokenOptions>(IdentityConstants.BearerScheme).Configure(options => {
options.BearerTokenExpiration = TimeSpan.FromDays(2);
});
// Add services to the container.
builder.Services.AddProblemDetails();