@@ -225,7 +225,7 @@ public boolean authenticate(final SecurityRequestChannel request) {
225
225
if (adminDns .isAdminDN (sslPrincipal )) {
226
226
// PKI authenticated REST call
227
227
User superuser = new User (sslPrincipal );
228
- UserSubject subject = new UserSubjectImpl (threadPool , new org . opensearch . security . common . user . User ( sslPrincipal ) );
228
+ UserSubject subject = new UserSubjectImpl (threadPool , superuser );
229
229
threadContext .putPersistent (ConfigConstants .OPENDISTRO_SECURITY_AUTHENTICATED_USER , subject );
230
230
threadContext .putTransient (ConfigConstants .OPENDISTRO_SECURITY_USER , superuser );
231
231
return true ;
@@ -393,14 +393,7 @@ public boolean authenticate(final SecurityRequestChannel request) {
393
393
final User effectiveUser = impersonatedUser == null ? authenticatedUser : impersonatedUser ;
394
394
threadPool .getThreadContext ().putTransient (ConfigConstants .OPENDISTRO_SECURITY_USER , effectiveUser );
395
395
396
- // TODO: The following artistry must be reverted when User class is completely moved to :opensearch-security-common
397
- org .opensearch .security .common .user .User effUser = new org .opensearch .security .common .user .User (
398
- effectiveUser .getName (),
399
- effectiveUser .getRoles (),
400
- null
401
- );
402
- effUser .setAttributes (effectiveUser .getCustomAttributesMap ());
403
- UserSubject subject = new UserSubjectImpl (threadPool , effUser );
396
+ UserSubject subject = new UserSubjectImpl (threadPool , effectiveUser );
404
397
threadPool .getThreadContext ().putPersistent (ConfigConstants .OPENDISTRO_SECURITY_AUTHENTICATED_USER , subject );
405
398
} else {
406
399
if (isDebugEnabled ) {
@@ -428,14 +421,7 @@ public boolean authenticate(final SecurityRequestChannel request) {
428
421
User anonymousUser = new User (User .ANONYMOUS .getName (), new HashSet <String >(User .ANONYMOUS .getRoles ()), null );
429
422
anonymousUser .setRequestedTenant (tenant );
430
423
431
- org .opensearch .security .common .user .User anonymousUserCommon = new org .opensearch .security .common .user .User (
432
- User .ANONYMOUS .getName (),
433
- new HashSet <>(User .ANONYMOUS .getRoles ()),
434
- null
435
- );
436
- anonymousUserCommon .setRequestedTenant (tenant );
437
-
438
- UserSubject subject = new UserSubjectImpl (threadPool , anonymousUserCommon );
424
+ UserSubject subject = new UserSubjectImpl (threadPool , anonymousUser );
439
425
440
426
threadPool .getThreadContext ().putTransient (ConfigConstants .OPENDISTRO_SECURITY_USER , anonymousUser );
441
427
threadPool .getThreadContext ().putPersistent (ConfigConstants .OPENDISTRO_SECURITY_AUTHENTICATED_USER , subject );
0 commit comments