mirror of
https://github.com/bitwarden/server
synced 2026-01-02 08:33:48 +00:00
fix(auth-validator): [PM-22975] Client Version Validator - Minor touchups to baserequest validator.
This commit is contained in:
@@ -122,6 +122,10 @@ public abstract class BaseRequestValidator<T> where T : class
|
||||
return;
|
||||
}
|
||||
|
||||
// 1.5 We need to check now the version number
|
||||
await ValidateClientVersionAsync(context, validatorContext);
|
||||
|
||||
|
||||
// 2. Decide if this user belongs to an organization that requires SSO.
|
||||
validatorContext.SsoRequired = await RequireSsoLoginAsync(user, request.GrantType);
|
||||
if (validatorContext.SsoRequired)
|
||||
|
||||
@@ -11,7 +11,8 @@ public interface IClientVersionValidator
|
||||
Task<bool> ValidateAsync(User user, CustomValidatorRequestContext requestContext);
|
||||
}
|
||||
|
||||
public class ClientVersionValidator(ICurrentContext currentContext,
|
||||
public class ClientVersionValidator(
|
||||
ICurrentContext currentContext,
|
||||
IGetMinimumClientVersionForUserQuery getMinimumClientVersionForUserQuery)
|
||||
: IClientVersionValidator
|
||||
{
|
||||
@@ -37,7 +38,7 @@ public class ClientVersionValidator(ICurrentContext currentContext,
|
||||
{
|
||||
requestContext.ValidationErrorResult = new ValidationResult
|
||||
{
|
||||
Error = "invalid_grant",
|
||||
Error = "invalid_client_version",
|
||||
ErrorDescription = UpgradeMessage,
|
||||
IsError = true
|
||||
};
|
||||
|
||||
@@ -16,11 +16,8 @@ using Bit.Core.Settings;
|
||||
using Duende.IdentityModel;
|
||||
using Duende.IdentityServer.Extensions;
|
||||
using Duende.IdentityServer.Validation;
|
||||
using HandlebarsDotNet;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Bit.Identity.IdentityServer.RequestValidators;
|
||||
|
||||
public class CustomTokenRequestValidator : BaseRequestValidator<CustomTokenRequestValidationContext>,
|
||||
|
||||
Reference in New Issue
Block a user