I would like to have an
AuthenticationHandler as a first stage (
ChannelnboundHandler) in a
ChannelPipeline. If the authentication check fails I would like to return an error response and skip the evaluation of the remaining handlers in the pipeline.
I would be nice if the documentation could be amended with some example for such use cases.
Subsequent handlers are not "automatically" called anyways. So if you inject an authentication handler in the pipeline, and the authentication did succeed, your auth handler is responsible for passing the data on (by calling fireChannelRead).
Here is an example for this. The NIOIRC parses ByteBuffers into IRCMessage values, and then passes them up the pipeline via fireChannelRead: https://github.com/NozeIO/swift-nio-irc/blob/develop/Sources/NIOIRC/IRCChannelHandler.swift#L61