Skip to content

Commit

Permalink
getConsumedParams only on NettyRequest
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Jan 31, 2024
1 parent 7b5e63b commit ab78f8e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public String param(String key) {
return urlParams != null ? params().get(key) : null;
}

@Override
public Set<String> getConsumedParams() {
return consumedParams;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
package org.opensearch.security.filter;

import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
import javax.net.ssl.SSLEngine;

Expand Down Expand Up @@ -54,9 +52,4 @@ default String header(final String headerName) {

/** Gets the parameter for the given key */
String param(String key);

/** Gets the parameters that have been consumed */
default Set<String> getConsumedParams() {
return Collections.emptySet();
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.http.netty4.Netty4HttpChannel;
import org.opensearch.http.netty4.Netty4HttpServerTransport;
import org.opensearch.security.filter.NettyRequest;
import org.opensearch.security.filter.SecurityRequestChannel;
import org.opensearch.security.filter.SecurityRequestChannelUnsupported;
import org.opensearch.security.filter.SecurityRequestFactory;
Expand Down Expand Up @@ -85,7 +86,9 @@ public void channelRead0(ChannelHandlerContext ctx, DefaultHttpRequest msg) thro
// If request channel is completed and a response is sent, then there was a failure during authentication
restFilter.checkAndAuthenticateRequest(requestChannel);

ctx.channel().attr(CONSUMED_PARAMS).set(requestChannel.getConsumedParams());
if (requestChannel instanceof NettyRequest) {
ctx.channel().attr(CONSUMED_PARAMS).set(((NettyRequest) requestChannel).getConsumedParams());
}

ThreadContext.StoredContext contextToRestore = threadPool.getThreadContext().newStoredContext(false);
ctx.channel().attr(CONTEXT_TO_RESTORE).set(contextToRestore);
Expand Down

0 comments on commit ab78f8e

Please sign in to comment.