[ https://issues.apache.org/jira/browse/CXF-8641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Freeman Yue Fang resolved CXF-8641. ----------------------------------- Fix Version/s: 3.4.6 3.5.1 4.0.0 Resolution: Fixed patch applied on behalf of [~globalbus] with thanks! > NPE on NamePasswordCallbackHandler > ---------------------------------- > > Key: CXF-8641 > URL: https://issues.apache.org/jira/browse/CXF-8641 > Project: CXF > Issue Type: Bug > Components: Core > Reporter: Jan Filipski > Assignee: Freeman Yue Fang > Priority: Major > Fix For: 3.4.6, 3.5.1, 4.0.0 > > > If Basic Auth password is empty, AbstractHTTPDestination sets password to > null. > Later, if NamePasswordCallbackHandler is used, it calls String.toCharArray() > on null password. > Standard authentication error should be present, without NullPointerException > Stacktrace looks like that > {code:java} > org.apache.cxf.interceptor.security.AuthenticationException: Authentication > failed: java.lang.NullPointerException > at > org.apache.cxf.interceptor.security.NamePasswordCallbackHandler.handle(NamePasswordCallbackHandler.java:67) > at > java.base/javax.security.auth.login.LoginContext$SecureCallbackHandler$1.run(LoginContext.java:904) > at > java.base/javax.security.auth.login.LoginContext$SecureCallbackHandler$1.run(LoginContext.java:901) > at java.base/java.security.AccessController.doPrivileged(Native Method) > at > java.base/javax.security.auth.login.LoginContext$SecureCallbackHandler.handle(LoginContext.java:901) > at > org.apache.karaf.jaas.modules.ldap.LDAPLoginModule.doLogin(LdapLoginModule.java:49) > at > org.apache.karaf.jaas.modules.ldap.LDAPLoginModule.login(LdapLoginModule.java:37) > at > org.apache.karaf.jaas.boot.ProxyLoginModule.login(ProxyLoginModule.java:83) > at > java.base/javax.security.auth.login.LoginContext.invoke(LoginContext.java:726) > at > java.base/javax.security.auth.login.LoginContext$4.run(LoginContext.java:665) > at > java.base/javax.security.auth.login.LoginContext$4.run(LoginContext.java:663) > at java.base/java.security.AccessController.doPrivileged(Native Method) > at > java.base/javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:663) > at > java.base/javax.security.auth.login.LoginContext.login(LoginContext.java:574) > at > org.apache.cxf.interceptor.security.JAASLoginInterceptor.handleMessage(JAASLoginInterceptor.java:140) > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > at > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) > at > org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) > at > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) > at > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) > at > org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) > at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1631) > at > org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1618) > at > org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:549) > at > org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) > at > org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) > at > org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) > at > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610) > at > org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1363) > at > org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:298) > at > org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) > at > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:489) > at > org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580) > at > org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1278) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) > at > org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:82) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) > at org.eclipse.jetty.server.Server.handle(Server.java:500) > at > org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) > at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547) > at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) > at > org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273) > at > org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) > at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) > at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) > at > org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) > at > org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) > at > org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) > at > org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) > at > org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375) > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) > at > org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) > at java.base/java.lang.Thread.run(Thread.java:834) at > org.apache.cxf.interceptor.security.JAASLoginInterceptor.handleMessage(JAASLoginInterceptor.java:166) > ~[?:?] > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) > ~[?:?] > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > ~[?:?] > at > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) > ~[?:?] > at > org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) > ~[?:?] > at > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) > ~[?:?] > at > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) > ~[?:?] > at > org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) > ~[?:?] > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) > ~[?:?] > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220) > ~[?:?] > at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) ~[?:?] > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) > ~[?:?] > at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763) > ~[?:?] > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1631) > ~[?:?] > at > org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226) > ~[?:?] > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1618) > ~[?:?] > at > org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:549) > ~[?:?] > at > org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) > ~[?:?] > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) > ~[?:?] > at > org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602) > ~[?:?] > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) > ~[?:?] > at > org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) > ~[?:?] > at > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610) > ~[?:?] > at > org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) > ~[?:?] > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1363) > ~[?:?] > at > org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:298) > ~[?:?] > at > org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) > ~[?:?] > at > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:489) > ~[?:?] > at > org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580) > ~[?:?] > at > org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) > ~[?:?] > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1278) > ~[?:?] > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) > ~[?:?] > at > org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:82) > ~[?:?] > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) > ~[?:?] > at org.eclipse.jetty.server.Server.handle(Server.java:500) ~[?:?] > at > org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) > ~[?:?] > at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547) > ~[?:?] > at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) > ~[?:?] > at > org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273) > ~[?:?] > at > org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) > ~[?:?] > at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) > ~[?:?] > at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) > ~[?:?] > at > org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) > ~[?:?] > at > org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) > ~[?:?] > at > org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) > ~[?:?] > at > org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) > ~[?:?] > at > org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375) > ~[?:?] > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) > ~[?:?] > at > org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) > ~[?:?] > at java.lang.Thread.run(Thread.java:834) [?:?] > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)