This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 3c8b33a393eda8f647f9d0985291839e2f34dae3
Author: Benoit TELLIER <btell...@linagora.com>
AuthorDate: Thu Nov 21 11:47:06 2024 +0100

    JAMES-4091 Add delegation details
---
 .../src/main/java/org/apache/james/imapserver/netty/IMAPServer.java  | 5 +++++
 .../integration/memory/MemoryWebAdminServerIntegrationTest.java      | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
 
b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
index e3ba88e277..9b0af883a3 100644
--- 
a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
+++ 
b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
@@ -48,6 +48,7 @@ import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.api.process.SelectedMailbox;
 import org.apache.james.imap.decode.ImapDecoder;
 import org.apache.james.imap.encode.ImapEncoder;
+import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.metrics.api.GaugeRegistry;
 import org.apache.james.protocols.api.OidcSASLConfiguration;
@@ -401,6 +402,10 @@ public class IMAPServer extends 
AbstractConfigurableAsyncServer implements ImapC
                     imapSession.map(ImapSession::isTLSActive).orElse(false),
                     imapSession.flatMap(session -> 
Optional.ofNullable(session.getUserName())),
                     ImmutableMap.<String, String>builder()
+                        .put("loggedInUser", imapSession.flatMap(s -> 
Optional.ofNullable(s.getMailboxSession()))
+                            .flatMap(MailboxSession::getLoggedInUser)
+                            .map(Username::asString)
+                            .orElse(""))
                         .put("isCompressed", 
Boolean.toString(imapSession.map(ImapSession::isCompressionActive).orElse(false)))
                         .put("selectedMailbox", imapSession.flatMap(session -> 
Optional.ofNullable(session.getSelected()))
                             .map(SelectedMailbox::getMailboxId)
diff --git 
a/server/protocols/webadmin-integration-test/memory-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/memory/MemoryWebAdminServerIntegrationTest.java
 
b/server/protocols/webadmin-integration-test/memory-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/memory/MemoryWebAdminServerIntegrationTest.java
index 156637f646..c63833fb9e 100644
--- 
a/server/protocols/webadmin-integration-test/memory-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/memory/MemoryWebAdminServerIntegrationTest.java
+++ 
b/server/protocols/webadmin-integration-test/memory-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/memory/MemoryWebAdminServerIntegrationTest.java
@@ -68,7 +68,6 @@ class MemoryWebAdminServerIntegrationTest extends 
WebAdminServerIntegrationTest
 
         when()
             .get("/servers/channels/" + USERNAME)
-            .prettyPeek()
         .then()
             .statusCode(HttpStatus.OK_200)
             .body("[0].protocol", is("IMAP"))
@@ -76,6 +75,7 @@ class MemoryWebAdminServerIntegrationTest extends 
WebAdminServerIntegrationTest
             .body("[0].username", is("bob@domain"))
             .body("[0].isEncrypted", is(false))
             .body("[0].isEncrypted", is(false))
+            .body("[0].protocolSpecificInformation.loggedInUser", 
is("bob@domain"))
             .body("[0].protocolSpecificInformation.userAgent", 
is("{name=Thunderbird, version=102.7.1}"))
             .body("[0].protocolSpecificInformation.requestCount", is("3"));
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to