@@ -157,6 +157,8 @@ Y_UNIT_TEST_SUITE(TWebLoginService) {
157
157
UNIT_ASSERT_STRING_CONTAINS (last, " status=SUCCESS" );
158
158
UNIT_ASSERT (!last.contains (" reason" ));
159
159
UNIT_ASSERT_STRING_CONTAINS (last, " login_user=user1" );
160
+ UNIT_ASSERT_STRING_CONTAINS (last, " sanitized_token=" );
161
+ UNIT_ASSERT (last.find (" sanitized_token={none}" ) == std::string::npos);
160
162
}
161
163
162
164
Y_UNIT_TEST (AuditLogLoginBadPassword) {
@@ -198,6 +200,7 @@ Y_UNIT_TEST_SUITE(TWebLoginService) {
198
200
UNIT_ASSERT_STRING_CONTAINS (last, " status=ERROR" );
199
201
UNIT_ASSERT_STRING_CONTAINS (last, " reason=Invalid password" );
200
202
UNIT_ASSERT_STRING_CONTAINS (last, " login_user=user1" );
203
+ UNIT_ASSERT_STRING_CONTAINS (last, " sanitized_token={none}" );
201
204
}
202
205
203
206
Y_UNIT_TEST (AuditLogLdapLoginSuccess) {
@@ -292,6 +295,8 @@ Y_UNIT_TEST_SUITE(TWebLoginService) {
292
295
UNIT_ASSERT (!last.contains (" detailed_status" ));
293
296
UNIT_ASSERT (!last.contains (" reason" ));
294
297
UNIT_ASSERT_STRING_CONTAINS (last, " login_user=user1@ldap" );
298
+ UNIT_ASSERT_STRING_CONTAINS (last, " sanitized_token=" );
299
+ UNIT_ASSERT (last.find (" sanitized_token={none}" ) == std::string::npos);
295
300
}
296
301
297
302
Y_UNIT_TEST (AuditLogLdapLoginBadPassword) {
@@ -386,6 +391,7 @@ Y_UNIT_TEST_SUITE(TWebLoginService) {
386
391
UNIT_ASSERT_STRING_CONTAINS (last, " detailed_status=UNAUTHORIZED" );
387
392
UNIT_ASSERT_STRING_CONTAINS (last, " reason=Could not login via LDAP: LDAP login failed for user uid=user1,dc=search,dc=yandex,dc=net on server ldap://localhost:" );
388
393
UNIT_ASSERT_STRING_CONTAINS (last, " login_user=user1@ldap" );
394
+ UNIT_ASSERT_STRING_CONTAINS (last, " sanitized_token={none}" );
389
395
}
390
396
391
397
Y_UNIT_TEST (AuditLogLdapLoginBadUser) {
@@ -480,6 +486,7 @@ Y_UNIT_TEST_SUITE(TWebLoginService) {
480
486
UNIT_ASSERT_STRING_CONTAINS (last, " detailed_status=UNAUTHORIZED" );
481
487
UNIT_ASSERT_STRING_CONTAINS (last, " reason=Could not login via LDAP: LDAP user bad_user does not exist. LDAP search for filter uid=bad_user on server ldap://localhost:" );
482
488
UNIT_ASSERT_STRING_CONTAINS (last, " login_user=bad_user@ldap" );
489
+ UNIT_ASSERT_STRING_CONTAINS (last, " sanitized_token={none}" );
483
490
}
484
491
485
492
// LDAP responses to bad BindDn or bad BindPassword are the same, so this test covers the both cases.
@@ -575,6 +582,7 @@ Y_UNIT_TEST_SUITE(TWebLoginService) {
575
582
UNIT_ASSERT_STRING_CONTAINS (last, " detailed_status=UNAUTHORIZED" );
576
583
UNIT_ASSERT_STRING_CONTAINS (last, " reason=Could not login via LDAP: Could not perform initial LDAP bind for dn cn=robouser,dc=search,dc=yandex,dc=net on server ldap://localhost:" );
577
584
UNIT_ASSERT_STRING_CONTAINS (last, " login_user=user1@ldap" );
585
+ UNIT_ASSERT_STRING_CONTAINS (last, " sanitized_token={none}" );
578
586
}
579
587
580
588
Y_UNIT_TEST (AuditLogLogout) {
@@ -677,6 +685,8 @@ Y_UNIT_TEST_SUITE(TWebLoginService) {
677
685
UNIT_ASSERT_STRING_CONTAINS (last, " subject=user1" );
678
686
UNIT_ASSERT_STRING_CONTAINS (last, " operation=LOGOUT" );
679
687
UNIT_ASSERT_STRING_CONTAINS (last, " status=SUCCESS" );
688
+ UNIT_ASSERT_STRING_CONTAINS (last, " sanitized_token=" );
689
+ UNIT_ASSERT (last.find (" sanitized_token={none}" ) == std::string::npos);
680
690
}
681
691
}
682
692
}
0 commit comments