Last Release before Release Testing (#2017)
* Attempting to invalidate JWT on login (when locked out), but can't figure a way to get a JWT, since we don't store them. Just committing as I'm going to remove the middleware, this is not worth the performance and complexity. * Removed some security stuff that didn't line up. * Dropping Token Expiration down to 2 days to test during release testing.
This commit is contained in:
parent
3eeb131985
commit
5a95911483
7 changed files with 88 additions and 6 deletions
|
@ -18,6 +18,7 @@ using API.Middleware.RateLimit;
|
|||
using API.Services;
|
||||
using API.SignalR;
|
||||
using AutoMapper;
|
||||
using EasyCaching.Core;
|
||||
using Hangfire;
|
||||
using Kavita.Common;
|
||||
using Kavita.Common.EnvironmentInfo;
|
||||
|
@ -44,6 +45,7 @@ public class AccountController : BaseApiController
|
|||
private readonly IAccountService _accountService;
|
||||
private readonly IEmailService _emailService;
|
||||
private readonly IEventHub _eventHub;
|
||||
private readonly IEasyCachingProviderFactory _cacheFactory;
|
||||
|
||||
/// <inheritdoc />
|
||||
public AccountController(UserManager<AppUser> userManager,
|
||||
|
@ -51,7 +53,8 @@ public class AccountController : BaseApiController
|
|||
ITokenService tokenService, IUnitOfWork unitOfWork,
|
||||
ILogger<AccountController> logger,
|
||||
IMapper mapper, IAccountService accountService,
|
||||
IEmailService emailService, IEventHub eventHub)
|
||||
IEmailService emailService, IEventHub eventHub,
|
||||
IEasyCachingProviderFactory cacheFactory)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_signInManager = signInManager;
|
||||
|
@ -62,6 +65,7 @@ public class AccountController : BaseApiController
|
|||
_accountService = accountService;
|
||||
_emailService = emailService;
|
||||
_eventHub = eventHub;
|
||||
_cacheFactory = cacheFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -187,8 +191,9 @@ public class AccountController : BaseApiController
|
|||
var result = await _signInManager
|
||||
.CheckPasswordSignInAsync(user, loginDto.Password, true);
|
||||
|
||||
if (result.IsLockedOut)
|
||||
if (result.IsLockedOut) // result.IsLockedOut
|
||||
{
|
||||
await _userManager.UpdateSecurityStampAsync(user);
|
||||
return Unauthorized("You've been locked out from too many authorization attempts. Please wait 10 minutes.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue