Skip to content

Commit

Permalink
Remove unneeded code
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Feb 22, 2024
1 parent c4e49b2 commit 1939a03
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 27 deletions.
15 changes: 0 additions & 15 deletions src/main/java/org/opensearch/security/auth/BackendRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import org.opensearch.security.user.User;
import org.opensearch.threadpool.ThreadPool;

import com.amazon.dlic.auth.http.jwt.HTTPJwtAuthenticator;
import org.greenrobot.eventbus.Subscribe;

import static org.apache.http.HttpStatus.SC_FORBIDDEN;
Expand All @@ -78,7 +77,6 @@ public class BackendRegistry {
protected final Logger log = LogManager.getLogger(this.getClass());
private SortedSet<AuthDomain> restAuthDomains;
private Set<AuthorizationBackend> restAuthorizers;
private Set<String> urlParamsToConsume = new HashSet<>();
private List<AuthFailureListener> ipAuthFailureListeners;
private Multimap<String, AuthFailureListener> authBackendFailureListeners;
private List<ClientBlockRegistry<InetAddress>> ipClientBlockRegistries;
Expand Down Expand Up @@ -157,10 +155,6 @@ public BackendRegistry(
createCaches();
}

public Set<String> getUrlParamsToConsume() {
return urlParamsToConsume;
}

public boolean isInitialized() {
return initialized;
}
Expand All @@ -187,15 +181,6 @@ public void onDynamicConfigModelChanged(DynamicConfigModel dcm) {
authBackendClientBlockRegistries = dcm.getAuthBackendClientBlockRegistries();

SortedSet<AuthDomain> authDomains = Collections.unmodifiableSortedSet(dcm.getRestAuthDomains());
urlParamsToConsume.clear();
for (AuthDomain authDomain : authDomains) {
if ("jwt".equals(authDomain.getHttpAuthenticator().getType())) {
HTTPJwtAuthenticator jwtAuthenticator = (HTTPJwtAuthenticator) authDomain.getHttpAuthenticator();
if (jwtAuthenticator.getJwtUrlParameter() != null) {
urlParamsToConsume.add(jwtAuthenticator.getJwtUrlParameter());
}
}
}

// OpenSearch Security no default authc
initialized = !restAuthDomains.isEmpty() || anonymousAuthEnabled || injectedUserEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ public class NettyRequest implements SecurityRequest {
protected final Netty4HttpChannel underlyingChannel;
protected final Supplier<CheckedAccessMap> parameters = Suppliers.memoize(() -> new CheckedAccessMap(params(uri())));

private final Set<String> consumedParams = new HashSet<>();

NettyRequest(final HttpRequest request, final Netty4HttpChannel channel) {
this.underlyingRequest = request;
this.underlyingChannel = channel;
Expand Down Expand Up @@ -98,10 +96,6 @@ public Set<String> getUnconsumedParams() {
return parameters.get().accessedKeys();
}

public Set<String> getConsumedParams() {
return consumedParams;
}

private static Map<String, String> params(String uri) {
// Sourced from
// https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/http/AbstractHttpServerTransport.java#L419-L422
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ public class ConfigConstants {
public static final boolean OPENDISTRO_SECURITY_AUDIT_SSL_VERIFY_HOSTNAMES_DEFAULT = true;
public static final boolean OPENDISTRO_SECURITY_AUDIT_SSL_ENABLE_SSL_CLIENT_AUTH_DEFAULT = false;
public static final String OPENDISTRO_SECURITY_AUDIT_EXCLUDE_SENSITIVE_HEADERS = "opendistro_security.audit.exclude_sensitive_headers";
public static final String OPENDISTRO_SECURITY_AUDIT_EXCLUDE_SENSITIVE_URL_PARAMETERS =
"opendistro_security.audit.exclude_sensitive_url_params";

public static final String SECURITY_AUDIT_CONFIG_DEFAULT_PREFIX = "plugins.security.audit.config.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public void testDefaultSerialize() throws IOException {
.field("log_request_body", true)
.field("resolve_indices", true)
.field("exclude_sensitive_headers", true)
.field("exclude_sensitive_url_params", true)
.field("ignore_users", Collections.singletonList("kibanaserver"))
.field("ignore_requests", Collections.emptyList())
.field("ignore_headers", Collections.emptyList())
Expand Down Expand Up @@ -135,7 +134,6 @@ public void testDeserialize() throws IOException {
.field("log_request_body", true)
.field("resolve_indices", true)
.field("exclude_sensitive_headers", true)
.field("exclude_sensitive_url_params", true)
.field("ignore_users", Collections.singletonList("test-user-1"))
.field("ignore_requests", Collections.singletonList("test-request"))
.field("ignore_headers", Collections.singletonList("test-headers"))
Expand Down Expand Up @@ -235,7 +233,6 @@ public void testSerialize() throws IOException {
.field("log_request_body", true)
.field("resolve_indices", true)
.field("exclude_sensitive_headers", true)
.field("exclude_sensitive_url_params", true)
.field("ignore_users", ImmutableList.of("ignore-user-1", "ignore-user-2"))
.field("ignore_requests", Collections.singletonList("ignore-request-1"))
.field("ignore_headers", Collections.singletonList("test-header"))
Expand Down Expand Up @@ -280,7 +277,6 @@ public void testNullSerialize() throws IOException {
.field("log_request_body", true)
.field("resolve_indices", true)
.field("exclude_sensitive_headers", true)
.field("exclude_sensitive_url_params", true)
.field("ignore_users", ImmutableList.of("kibanaserver"))
.field("ignore_requests", Collections.emptyList())
.field("ignore_headers", Collections.emptyList())
Expand Down

0 comments on commit 1939a03

Please sign in to comment.