Расширил жизнь bearer токена
This commit is contained in:
parent
7d4edb6caa
commit
25fc0701e1
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user