Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f7948dfe62 | |||
| f940df1145 | |||
| d576b7cb19 | |||
| 7a9fe5a124 |
@@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using NexusReader.Domain.Entities;
|
||||
using NexusReader.Infrastructure.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace NexusReader.Infrastructure.Identity;
|
||||
|
||||
@@ -12,12 +11,12 @@ namespace NexusReader.Infrastructure.Identity;
|
||||
/// </summary>
|
||||
public class TokenLimitHandler : AuthorizationHandler<TokenLimitRequirement>
|
||||
{
|
||||
private readonly IDbContextFactory<AppDbContext> _dbContextFactory;
|
||||
private readonly AppDbContext _dbContext;
|
||||
private readonly UserManager<NexusUser> _userManager;
|
||||
|
||||
public TokenLimitHandler(IDbContextFactory<AppDbContext> dbContextFactory, UserManager<NexusUser> userManager)
|
||||
public TokenLimitHandler(AppDbContext dbContext, UserManager<NexusUser> userManager)
|
||||
{
|
||||
_dbContextFactory = dbContextFactory;
|
||||
_dbContext = dbContext;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,8 +135,7 @@ using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var services = scope.ServiceProvider;
|
||||
var logger = services.GetRequiredService<ILogger<Program>>();
|
||||
var dbContextFactory = services.GetRequiredService<IDbContextFactory<NexusReader.Infrastructure.Persistence.AppDbContext>>();
|
||||
using var dbContext = await dbContextFactory.CreateDbContextAsync();
|
||||
var dbContext = services.GetRequiredService<NexusReader.Infrastructure.Persistence.AppDbContext>();
|
||||
|
||||
int maxRetries = 5;
|
||||
int delayMs = 2000;
|
||||
|
||||
Reference in New Issue
Block a user