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

jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new e44b8d2b0b ARTEMIS-5587: use HttpServerAuthenticator within TCCL
e44b8d2b0b is described below

commit e44b8d2b0bda9ccde15090f3e299eb6210034503
Author: Grzegorz Grzybek <[email protected]>
AuthorDate: Fri Jul 25 13:00:34 2025 +0200

    ARTEMIS-5587: use HttpServerAuthenticator within TCCL
    
    Signed-off-by: Grzegorz Grzybek <[email protected]>
---
 .../artemis/spi/core/security/jaas/HttpServerAuthenticator.java      | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/HttpServerAuthenticator.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/HttpServerAuthenticator.java
index b84facdc3e..0f443e86fb 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/HttpServerAuthenticator.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/HttpServerAuthenticator.java
@@ -53,8 +53,9 @@ public class HttpServerAuthenticator extends Authenticator {
 
    @Override
    public Result authenticate(HttpExchange httpExchange) {
-
+      ClassLoader currentTCCL = Thread.currentThread().getContextClassLoader();
       try {
+         
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
          LoginContext loginContext = new LoginContext(realm, callbacks -> {
             for (Callback callback : callbacks) {
                if (callback instanceof PasswordCallback passwordCallback) {
@@ -108,6 +109,8 @@ public class HttpServerAuthenticator extends Authenticator {
          return new Authenticator.Success(new 
HttpPrincipal(nameFromAuthSubject(loginContext.getSubject()), realm));
       } catch (Exception e) {
          return new Authenticator.Failure(401);
+      } finally {
+         Thread.currentThread().setContextClassLoader(currentTCCL);
       }
    }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to