Class HttpHeadersAuthenticatorUtils

java.lang.Object
org.elasticsearch.http.netty4.internal.HttpHeadersAuthenticatorUtils

public final class HttpHeadersAuthenticatorUtils extends Object
Provides utilities for hooking into the netty pipeline and authenticate each HTTP request's headers. See also Netty4HttpHeaderValidator.
  • Method Details

    • getValidatorInboundHandler

      public static Netty4HttpHeaderValidator getValidatorInboundHandler(HttpValidator validator, ThreadContext threadContext)
      Supplies a netty ChannelInboundHandler that runs the provided on the HTTP request headers. The HTTP headers of the to-be-authenticated HttpRequest must be wrapped by the special HttpHeadersWithAuthenticationContext, see wrapAsMessageWithAuthenticationContext(HttpMessage).
    • wrapAsMessageWithAuthenticationContext

      public static io.netty.handler.codec.http.HttpMessage wrapAsMessageWithAuthenticationContext(io.netty.handler.codec.http.HttpMessage newlyDecodedMessage)
      Given a DefaultHttpRequest argument, this returns a new DefaultHttpRequest instance that's identical to the passed-in one, but the headers of the latter can be authenticated, in the sense that the channel handlers returned by getValidatorInboundHandler(HttpValidator, ThreadContext) can use this to convey the authentication result context.
    • extractAuthenticationContext

      public static ThreadContext.StoredContext extractAuthenticationContext(HttpRequest request)
      Returns the authentication thread context for the .
    • asHttpPreRequest

      public static HttpPreRequest asHttpPreRequest(io.netty.handler.codec.http.HttpRequest request)
      Translates the netty request internal type to a HttpPreRequest instance that code outside the network plugin has access to.