1
0
mirror of https://github.com/bitwarden/server synced 2026-01-02 00:23:40 +00:00

test(auth-validator): [PM-22975] Client Version Validator - WIP changes.

This commit is contained in:
Patrick Pimentel
2025-12-02 13:46:23 -05:00
parent 8f89694f07
commit 8b8694e589
13 changed files with 65 additions and 35 deletions

View File

@@ -343,7 +343,7 @@ public class IdentityServerSsoTests
{ "code_verifier", challenge },
{ "redirect_uri", "https://localhost:8080/sso-connector.html" }
}),
http => { http.Request.Headers.Append("Bitwarden-Client-Version", "2025.11.0"); });
http => { http.Request.Headers.Append("Bitwarden-Client-Version", "2025.10.0"); });
// Assert
// If the organization has selected TrustedDeviceEncryption but the user still has their master password
@@ -415,7 +415,7 @@ public class IdentityServerSsoTests
}),
http =>
{
http.Request.Headers.Append("Bitwarden-Client-Version", "2025.11.0");
http.Request.Headers.Append("Bitwarden-Client-Version", "2025.10.0");
http.Request.Headers.Append("Accept", "application/json");
});
@@ -491,7 +491,7 @@ public class IdentityServerSsoTests
{ "code_verifier", challenge },
{ "redirect_uri", "https://localhost:8080/sso-connector.html" }
}),
http => { http.Request.Headers.Append("Bitwarden-Client-Version", "2025.11.0"); });
http => { http.Request.Headers.Append("Bitwarden-Client-Version", "2025.10.0"); });
Assert.Equal(StatusCodes.Status200OK, context.Response.StatusCode);
using var responseBody = await AssertHelper.AssertResponseTypeIs<JsonDocument>(context);
@@ -569,7 +569,7 @@ public class IdentityServerSsoTests
{ "code_verifier", challenge },
{ "redirect_uri", "https://localhost:8080/sso-connector.html" }
}),
http => { http.Request.Headers.Append("Bitwarden-Client-Version", "2025.11.0"); });
http => { http.Request.Headers.Append("Bitwarden-Client-Version", "2025.10.0"); });
// If this fails, surface detailed error information to aid debugging
if (context.Response.StatusCode != StatusCodes.Status200OK)
@@ -656,8 +656,11 @@ public class IdentityServerSsoTests
factory.SubstituteService<IAuthorizationCodeStore>(service =>
{
service.GetAuthorizationCodeAsync("test_code")
// Return our pre-built authorization code regardless of handle representation
service.GetAuthorizationCodeAsync(Arg.Any<string>())
.Returns(authorizationCode);
service.RemoveAuthorizationCodeAsync(Arg.Any<string>())
.Returns(Task.CompletedTask);
});
var user = await factory.RegisterNewIdentityFactoryUserAsync(

View File

@@ -387,10 +387,10 @@ public class IdentityServerTwoFactorTests : IClassFixture<IdentityApplicationFac
KdfIterations = AuthConstants.PBKDF2_ITERATIONS.Default,
UserAsymmetricKeys = new KeysRequestModel()
{
PublicKey = "public_key",
EncryptedPrivateKey = "private_key"
PublicKey = Bit.Test.Common.Constants.TestEncryptionConstants.PublicKey,
EncryptedPrivateKey = Bit.Test.Common.Constants.TestEncryptionConstants.V1EncryptedBase64
},
UserSymmetricKey = "sym_key",
UserSymmetricKey = Bit.Test.Common.Constants.TestEncryptionConstants.V1EncryptedBase64,
});
Assert.NotNull(user);
@@ -441,10 +441,10 @@ public class IdentityServerTwoFactorTests : IClassFixture<IdentityApplicationFac
KdfIterations = AuthConstants.PBKDF2_ITERATIONS.Default,
UserAsymmetricKeys = new KeysRequestModel()
{
PublicKey = "public_key",
EncryptedPrivateKey = "private_key"
PublicKey = Bit.Test.Common.Constants.TestEncryptionConstants.PublicKey,
EncryptedPrivateKey = Bit.Test.Common.Constants.TestEncryptionConstants.V1EncryptedBase64
},
UserSymmetricKey = "sym_key",
UserSymmetricKey = Bit.Test.Common.Constants.TestEncryptionConstants.V1EncryptedBase64,
});
var userService = factory.GetService<IUserService>();