Skip to content

Commit c55193d

Browse files
committed
Restore sessionId absence assertion in audit log helpers
Add WebAuthenticationDetails case to extractRemoteAddress switch so TokenEndpointAuthenticationFilter's plain WebAuthenticationDetails contributes its remote address to the audit origin instead of falling into the default branch and emitting a spurious WARN per event. Use Optional.of (not ofNullable) for WebAuthenticationDetails.getRemoteAddress() which carries a non-null contract under JSpecify @NullMarked. Restore .doesNotContain("sessionId") guards in assertLogMessage and assertGroupMembershipLogMessage so regressions that leak session or token fields into audit origins are caught by the test suite.
1 parent 3f3f395 commit c55193d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

uaa/src/test/java/org/cloudfoundry/identity/uaa/mock/audit/AuditCheckMockMvcTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,12 +1392,14 @@ private void assertLogMessage(String actualLogMessage, AuditEventType expectedAu
13921392
assertThat(actualLogMessage).startsWith(expectedAuditEventType.toString() + " ")
13931393
.contains("principal=%s,".formatted(expectedPrincipal))
13941394
.contains(" ('%s'): ".formatted(expectedUserName))
1395-
.contains(", identityZoneId=[uaa]");
1395+
.contains(", identityZoneId=[uaa]")
1396+
.doesNotContain("sessionId");
13961397
}
13971398

13981399
private static void assertGroupMembershipLogMessage(String actualLogMessage, AuditEventType expectedEventType, String expectedGroupDisplayName, String expectedGroupId, String... expectedUserIds) {
13991400
assertThat(actualLogMessage).startsWith(expectedEventType.toString() + " ")
1400-
.contains("principal=%s,".formatted(expectedGroupId));
1401+
.contains("principal=%s,".formatted(expectedGroupId))
1402+
.doesNotContain("sessionId");
14011403

14021404
Pattern groupLogPattern = Pattern.compile(" \\('\\{\"group_name\":\"" + Pattern.quote(expectedGroupDisplayName) + "\",\"members\":\\[(.*?)]}'\\): ");
14031405
Matcher patternMatcher = groupLogPattern.matcher(actualLogMessage);

0 commit comments

Comments
 (0)