Fixes AuthenticationContextFactory time validation stuff

This commit is contained in:
Jordan Brown
2018-10-11 10:46:56 -04:00
parent 3b1ab66772
commit a6f235e12e
2 changed files with 3 additions and 3 deletions
@@ -42,7 +42,7 @@ namespace Tgstation.Server.Host.Security
}
/// <inheritdoc />
public async Task CreateAuthenticationContext(long userId, long? instanceId, DateTimeOffset validBefore, CancellationToken cancellationToken)
public async Task CreateAuthenticationContext(long userId, long? instanceId, DateTimeOffset validAfter, CancellationToken cancellationToken)
{
if (CurrentAuthenticationContext != null)
throw new InvalidOperationException("Authentication context has already been loaded");
@@ -72,7 +72,7 @@ namespace Tgstation.Server.Host.Security
}
else
{
if (user.LastPasswordUpdate.HasValue && user.LastPasswordUpdate > validBefore)
if (user.LastPasswordUpdate.HasValue && user.LastPasswordUpdate < validAfter)
{
CurrentAuthenticationContext = new AuthenticationContext();
return;
@@ -19,7 +19,7 @@ namespace Tgstation.Server.Host.Security
/// </summary>
/// <param name="userId">The <see cref="Api.Models.Internal.User.Id"/> of the <see cref="IAuthenticationContext.User"/></param>
/// <param name="instanceId">The <see cref="Api.Models.Instance.Id"/> of the operation</param>
/// <param name="validBefore">The <see cref="DateTimeOffset"/> the resulting <see cref="IAuthenticationContext.User"/>'s password must be valid before</param>
/// <param name="validAfter">The <see cref="DateTimeOffset"/> the resulting <see cref="IAuthenticationContext.User"/>'s password must be valid after</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
/// <returns>A <see cref="Task"/> representing the running operation</returns>
Task CreateAuthenticationContext(long userId, long? instanceId, DateTimeOffset validBefore, CancellationToken cancellationToken);