Skip to content

Glowmarkt binding: Authentication failure not handled gracefully due to Jetty AuthenticationProtocolHandler #6

Description

@rtuck99

If the supplied password is wrong, the binding reports the stack trace below, because Jetty Http Client expects WWW-Authenticate header on 401 and then throws ExecutionException, rather than just returning the 401 response code. We should configure the client to ignore this, so that we can get a more sensible error message.

2022-09-30 17:12:59.122 [DEBUG] [ternal.GlowmarktVirtualEntityHandler] - Problem fetching resource data: Unable to authenticate
java.io.IOException: Unable to authenticate
at com.qubular.glowmarkt.impl.GlowmarktServiceImpl.authenticate(GlowmarktServiceImpl.java:106) ~[?:?]
at com.qubular.binding.glowmarkt.internal.GlowmarktBridgeHandler.getGlowmarktSession(GlowmarktBridgeHandler.java:170) ~[?:?]
at com.qubular.binding.glowmarkt.internal.GlowmarktVirtualEntityHandler.fetchHistoricDataForMissingPeriod(GlowmarktVirtualEntityHandler.java:143) ~[?:?]
at com.qubular.binding.glowmarkt.internal.GlowmarktVirtualEntityHandler.fetchHistoricData(GlowmarktVirtualEntityHandler.java:131) ~[?:?]
at com.qubular.binding.glowmarkt.internal.GlowmarktVirtualEntityHandler.handleCommand(GlowmarktVirtualEntityHandler.java:97) ~[?:?]
at com.qubular.binding.glowmarkt.internal.GlowmarktBridgeHandler.lambda$resourceUpdateJob$1(GlowmarktBridgeHandler.java:125) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) ~[?:?]
at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) ~[?:?]
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:730) ~[?:?]
at com.qubular.glowmarkt.impl.GlowmarktServiceImpl.authenticate(GlowmarktServiceImpl.java:96) ~[?:?]
... 11 more
Caused by: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
at org.eclipse.jetty.client.AuthenticationProtocolHandler$AuthenticationListener.onComplete(AuthenticationProtocolHandler.java:164) ~[?:?]
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:218) ~[?:?]
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:210) ~[?:?]
at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:481) ~[?:?]
at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:461) ~[?:?]
at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:424) ~[?:?]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions