Class HttpHeadersAuthenticatorUtils
java.lang.Object
org.elasticsearch.http.netty4.internal.HttpHeadersAuthenticatorUtils
Provides utilities for hooking into the netty pipeline and authenticate each HTTP request's headers.
See also
Netty4HttpHeaderValidator.-
Method Summary
Modifier and TypeMethodDescriptionstatic HttpPreRequestasHttpPreRequest(io.netty.handler.codec.http.HttpRequest request) Translates the netty request internal type to aHttpPreRequestinstance that code outside the network plugin has access to.static ThreadContext.StoredContextextractAuthenticationContext(HttpRequest request) Returns the authentication thread context for the .static Netty4HttpHeaderValidatorgetValidatorInboundHandler(HttpValidator validator, ThreadContext threadContext) Supplies a nettyChannelInboundHandlerthat runs the provided on the HTTP request headers.static io.netty.handler.codec.http.HttpMessagewrapAsMessageWithAuthenticationContext(io.netty.handler.codec.http.HttpMessage newlyDecodedMessage) Given aDefaultHttpRequestargument, this returns a newDefaultHttpRequestinstance 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 bygetValidatorInboundHandler(HttpValidator, ThreadContext)can use this to convey the authentication result context.
-
Method Details
-
getValidatorInboundHandler
public static Netty4HttpHeaderValidator getValidatorInboundHandler(HttpValidator validator, ThreadContext threadContext) Supplies a nettyChannelInboundHandlerthat runs the provided on the HTTP request headers. The HTTP headers of the to-be-authenticatedHttpRequestmust be wrapped by the specialHttpHeadersWithAuthenticationContext, seewrapAsMessageWithAuthenticationContext(HttpMessage). -
wrapAsMessageWithAuthenticationContext
public static io.netty.handler.codec.http.HttpMessage wrapAsMessageWithAuthenticationContext(io.netty.handler.codec.http.HttpMessage newlyDecodedMessage) Given aDefaultHttpRequestargument, this returns a newDefaultHttpRequestinstance 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 bygetValidatorInboundHandler(HttpValidator, ThreadContext)can use this to convey the authentication result context. -
extractAuthenticationContext
Returns the authentication thread context for the . -
asHttpPreRequest
Translates the netty request internal type to aHttpPreRequestinstance that code outside the network plugin has access to.
-