gnodet-bot commented on code in PR #14173:
URL: https://github.com/apache/maven/pull/14173#discussion_r4728857797


##########
pom.xml:
##########
@@ -146,7 +146,7 @@ under the License.
     <!-- plexus-cipher 2.1.0 uses an incompatible KDF; ciphertext encrypted 
with 2.0 will no longer decrypt — see #12811. Do not bump on this branch. -->
     <cipherVersion>2.0</cipherVersion>
     <jxpathVersion>1.4.0</jxpathVersion>
-    <resolverVersion>2.0.26</resolverVersion>
+    <resolverVersion>2.0.27-SNAPSHOT</resolverVersion>

Review Comment:
   🔖 **Tracking note:** `resolverVersion` is set to `2.0.27-SNAPSHOT`, pending 
merge/release of apache/maven-resolver#2372 (currently open). This must be 
updated to the final `2.0.27` release before this PR can be merged.



##########
maven-settings-builder/src/test/java/org/apache/maven/settings/validation/DefaultSettingsValidatorTest.java:
##########
@@ -321,6 +321,33 @@ void 
testValidateServerRepositoryOriginWithPlaceholderIsNotValidated() {
         assertEquals(0, problems.messages.size());
     }
 
+    @Test
+    void testValidateServerBearerTokenWithUsernameIsWarnedAbout() {
+        assertEquals(0, validateBearerToken("token", null, 
null).messages.size());
+        assertEquals(0, validateBearerToken(null, "user", 
"pwd").messages.size());
+
+        SimpleProblemCollector problems = validateBearerToken("token", "user", 
null);
+        assertEquals(1, problems.messages.size());
+        assertContains(
+                problems.messages.get(0),
+                "'servers.server[0].bearerToken' for server-1 is set together 
with username and/or password");
+        assertEquals(1, validateBearerToken("token", null, 
"pwd").messages.size());

Review Comment:
   💡 **Minor:** Consider adding the all-three-set case (`token + username + 
password`) explicitly. It's logically implied by the current assertions (since 
the validator fires when `token && (username || password)`), but an explicit 
assertion documents the expected behaviour for the combined case and prevents a 
future refactor from accidentally regressing it.
   
   ```suggestion
           assertEquals(0, validateBearerToken("token", null, 
null).messages.size());
           assertEquals(0, validateBearerToken(null, "user", 
"pwd").messages.size());
   
           SimpleProblemCollector problems = validateBearerToken("token", 
"user", null);
           assertEquals(1, problems.messages.size());
           assertContains(
                   problems.messages.get(0),
                   "'servers.server[0].bearerToken' for server-1 is set 
together with username and/or password");
           assertEquals(1, validateBearerToken("token", null, 
"pwd").messages.size());
           assertEquals(1, validateBearerToken("token", "user", 
"pwd").messages.size());
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to