Skip to content

Commit

Permalink
Remove .setTlsDetailsFactory as it has not effect
Browse files Browse the repository at this point in the history
Adds some more JavaDocs
  • Loading branch information
AlexRuiz7 committed Dec 18, 2024
1 parent 7f29409 commit 2caed58
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
7 changes: 7 additions & 0 deletions imposter/wazuh-server-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ security:


resources:
- method: GET
path: /_spec/*
response:
statusCode: 200
security:
default: Permit

- method: GET
path: /
response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import reactor.util.annotation.NonNull;

/** Command's fields. */
public class Command implements ToXContentObject {
public static final String COMMAND = "command";
public static final String ORDER_ID = "order_id";
Expand Down Expand Up @@ -145,6 +146,14 @@ public static Command parse(XContentParser parser)
}
}

/**
* Parses the request's payload into the Command[] model.
*
* @param parser XContentParser from the Rest Request
* @return instance of Command
* @throws IOException error parsing request content
* @throws IllegalArgumentException missing arguments
*/
public static List<Command> parseToArray(XContentParser parser)
throws IOException, IllegalArgumentException {
List<Command> commands = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@
import com.wazuh.commandmanager.auth.HTTPAuthenticator;
import com.wazuh.commandmanager.settings.PluginSettings;

/** HttpRestClient with authentication. */
public class AuthHttpRestClient extends HttpRestClient implements HTTPAuthenticator {

public static final String SECURITY_USER_AUTHENTICATE = "/security/user/authenticate";
private static final Logger log = LogManager.getLogger(AuthHttpRestClient.class);

/** Wazuh Server Management API endpoint for basic authentication. */
public static final String SECURITY_USER_AUTHENTICATE = "/security/user/authenticate";

/** Maximum number of authentication retries before giving up. */
public static final int MAX_RETRIES = 3;

private final AuthCredentials credentials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.net.URIBuilder;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.reactor.ssl.TlsDetails;
import org.apache.hc.core5.ssl.SSLContextBuilder;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -104,16 +103,8 @@ private void startHttpAsyncClient() {
.loadTrustMaterial(null, (chains, authType) -> true)
.build();

@SuppressWarnings("deprecation")
final TlsStrategy tlsStrategy =
ClientTlsStrategyBuilder.create()
.setSslContext(sslContext)
.setTlsDetailsFactory(
sslEngine ->
new TlsDetails(
sslEngine.getSession(),
sslEngine.getApplicationProtocol()))
.build();
ClientTlsStrategyBuilder.create().setSslContext(sslContext).build();

final PoolingAsyncClientConnectionManager connectionManager =
PoolingAsyncClientConnectionManagerBuilder.create()
Expand Down

0 comments on commit 2caed58

Please sign in to comment.