Clean up deprecated Java libs for STS integration with Kinesis client
diff --git a/localstack/constants.py b/localstack/constants.py
index 80565c1f97f5a..a24ac0c163cf8 100644
--- a/localstack/constants.py
+++ b/localstack/constants.py
@@ -137,9 +137,6 @@
 ELASTICMQ_JAR_URL = (
     "https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-1.1.0.jar"
 )
-STS_JAR_URL = (
-    f"{MAVEN_REPO_URL}/com/amazonaws/aws-java-sdk-sts/1.11.14/aws-java-sdk-sts-1.11.14.jar"
-)
 STEPFUNCTIONS_ZIP_URL = "https://s3.amazonaws.com/stepfunctionslocal/StepFunctionsLocal.zip"
 KMS_URL_PATTERN = "https://s3-eu-west-2.amazonaws.com/local-kms/3/local-kms_<arch>.bin"
 
diff --git a/localstack/services/install.py b/localstack/services/install.py
index 3af3ee0fc3eed..d9bdd3f277ce8 100644
--- a/localstack/services/install.py
+++ b/localstack/services/install.py
@@ -32,10 +32,8 @@
     LIBSQLITE_AARCH64_URL,
     LOCALSTACK_MAVEN_VERSION,
     MAVEN_REPO_URL,
-    MODULE_MAIN_PATH,
     OPENSEARCH_DEFAULT_VERSION,
     OPENSEARCH_PLUGIN_LIST,
-    STS_JAR_URL,
 )
 from localstack.runtime import hooks
 from localstack.utils.archives import untar, unzip
@@ -51,7 +49,7 @@
 )
 from localstack.utils.functions import run_safe
 from localstack.utils.http import download
-from localstack.utils.platform import get_arch, is_mac_os, is_windows
+from localstack.utils.platform import get_arch, is_mac_os
 from localstack.utils.run import run
 from localstack.utils.sync import retry
 from localstack.utils.threads import parallelize
@@ -653,30 +651,6 @@ def upgrade_jar_file(base_dir: str, file_glob: str, maven_asset: str):
     download(maven_asset_url, target_file)
 
 
-def install_amazon_kinesis_client_libs():
-    # install KCL/STS JAR files
-    if not os.path.exists(INSTALL_PATH_KCL_JAR):
-        mkdir(INSTALL_DIR_KCL)
-        tmp_archive = os.path.join(tempfile.gettempdir(), "aws-java-sdk-sts.jar")
-        if not os.path.exists(tmp_archive):
-            download(STS_JAR_URL, tmp_archive)
-        shutil.copy(tmp_archive, INSTALL_DIR_KCL)
-
-    # Compile Java files
-    from localstack.utils.kinesis import kclipy_helper
-
-    classpath = kclipy_helper.get_kcl_classpath()
-
-    if is_windows():
-        classpath = re.sub(r":([^\\])", r";\1", classpath)
-    java_files = f"{MODULE_MAIN_PATH}/utils/kinesis/java/cloud/localstack/*.java"
-    class_files = f"{MODULE_MAIN_PATH}/utils/kinesis/java/cloud/localstack/*.class"
-    if not glob.glob(class_files):
-        run(
-            f'javac -source {JAVAC_TARGET_VERSION} -target {JAVAC_TARGET_VERSION} -cp "{classpath}" {java_files}'
-        )
-
-
 def install_lambda_java_libs():
     # install LocalStack "fat" JAR file (contains all dependencies)
     if not os.path.exists(INSTALL_PATH_LOCALSTACK_FAT_JAR):
@@ -874,7 +848,6 @@ def get_installer(self) -> List[Installer]:
             ("elasticsearch", install_elasticsearch),
             ("opensearch", install_opensearch),
             ("kinesalite", install_kinesalite),
-            ("kinesis-client-libs", install_amazon_kinesis_client_libs),
             ("kinesis-mock", install_kinesis_mock),
             ("lambda-java-libs", install_lambda_java_libs),
             ("local-kms", install_local_kms),
@@ -920,7 +893,6 @@ def main():
             install_all_components()
         if sys.argv[1] in ("libs", "testlibs"):
             # Install additional libraries for testing
-            install_amazon_kinesis_client_libs()
             install_lambda_java_testlibs()
         print("Done.")
 
diff --git a/localstack/utils/kinesis/java/cloud/localstack/DefaultSTSAssumeRoleSessionCredentialsProvider.java b/localstack/utils/kinesis/java/cloud/localstack/DefaultSTSAssumeRoleSessionCredentialsProvider.java
deleted file mode 100644
index fa40be599ab76..0000000000000
--- a/localstack/utils/kinesis/java/cloud/localstack/DefaultSTSAssumeRoleSessionCredentialsProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-// TODO: double-check - can potentially be removed!
-
-package cloud.localstack;
-
-import java.util.Map;
-
-import com.amazonaws.auth.AWSCredentialsProvider;
-import com.amazonaws.auth.BasicSessionCredentials;
-import com.amazonaws.auth.InstanceProfileCredentialsProvider;
-import com.amazonaws.auth.STSAssumeRoleSessionCredentialsProvider;
-import com.amazonaws.auth.AWSStaticCredentialsProvider;
-
-/**
- * Custom session credentials provider that can be configured to assume a given IAM role.
- * Configure the role to assume via the following environment variables:
- * - AWS_ASSUME_ROLE_ARN : ARN of the role to assume
- * - AWS_ASSUME_ROLE_SESSION_NAME : name of the session to be used when calling assume-role
- *
- * As long lived credentials, this credentials provider attempts to uses the following:
- * - an STS token, via environment variables AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
- * - instance profile credentials provider (see Google hits for "EC2 instance metadata service")
- *
- * TODO: Potentially we could simply use the default credentials provider to obtain the long-lived credentials.
- *
- * @author Waldemar Hummer
- */
-public class DefaultSTSAssumeRoleSessionCredentialsProvider extends STSAssumeRoleSessionCredentialsProvider {
-
-	public DefaultSTSAssumeRoleSessionCredentialsProvider() {
-		super(getLongLivedCredentialsProvider(), getDefaultRoleARN(), getDefaultRoleSessionName());
-	}
-
-	private static String getDefaultRoleARN() {
-		Map<String, String> env = System.getenv();
-		return env.get("AWS_ASSUME_ROLE_ARN");
-	}
-
-	private static String getDefaultRoleSessionName() {
-		Map<String, String> env = System.getenv();
-		return env.get("AWS_ASSUME_ROLE_SESSION_NAME");
-	}
-
-	private static AWSCredentialsProvider getLongLivedCredentialsProvider() {
-		Map<String, String> env = System.getenv();
-		if(env.containsKey("AWS_SESSION_TOKEN")) {
-			return new AWSStaticCredentialsProvider(
-				new BasicSessionCredentials(
-					env.get("AWS_ACCESS_KEY_ID"),
-					env.get("AWS_SECRET_ACCESS_KEY"),
-					env.get("AWS_SESSION_TOKEN")));
-		}
-		return new InstanceProfileCredentialsProvider(false);
-	}
-
-	public static void main(String args[]) throws Exception {
-		System.out.println(new DefaultSTSAssumeRoleSessionCredentialsProvider().getCredentials());
-	}
-
-}
diff --git a/localstack/utils/kinesis/kinesis_connector.py b/localstack/utils/kinesis/kinesis_connector.py
index feff2bd10f9b9..c562eaab7a751 100644
--- a/localstack/utils/kinesis/kinesis_connector.py
+++ b/localstack/utils/kinesis/kinesis_connector.py
@@ -307,7 +307,7 @@ def get_stream_info(
 
 
 def start_kcl_client_process(
-    stream_name,
+    stream_name: str,
     listener_script,
     log_file=None,
     env=None,
@@ -328,26 +328,8 @@ def start_kcl_client_process(
     env = aws_stack.get_environment(env)
     # make sure to convert stream ARN to stream name
     stream_name = aws_stack.kinesis_stream_name(stream_name)
-    # decide which credentials provider to use
-    credentialsProvider = None
-    if ("AWS_ASSUME_ROLE_ARN" in os.environ or "AWS_ASSUME_ROLE_ARN" in env_vars) and (
-        "AWS_ASSUME_ROLE_SESSION_NAME" in os.environ or "AWS_ASSUME_ROLE_SESSION_NAME" in env_vars
-    ):
-        # use special credentials provider that can assume IAM roles and handle temporary STS auth tokens
-        credentialsProvider = "cloud.localstack.DefaultSTSAssumeRoleSessionCredentialsProvider"
-        # pass through env variables to child process
-        for var_name in [
-            "AWS_ASSUME_ROLE_ARN",
-            "AWS_ASSUME_ROLE_SESSION_NAME",
-            "AWS_ACCESS_KEY_ID",
-            "AWS_SECRET_ACCESS_KEY",
-            "AWS_SESSION_TOKEN",
-        ]:
-            if var_name in os.environ and var_name not in env_vars:
-                env_vars[var_name] = os.environ[var_name]
     if aws_stack.is_local_env(env):
-        # need to disable CBOR protocol, enforce use of plain JSON,
-        # see https://github.com/mhart/kinesalite/issues/31
+        # disable CBOR protocol, enforce use of plain JSON
         env_vars["AWS_CBOR_DISABLE"] = "true"
     if kcl_log_level or (len(log_subscribers) > 0):
         if not log_file:
@@ -390,7 +372,6 @@ def start_kcl_client_process(
         executableName=listener_script,
         streamName=stream_name,
         applicationName=stream_info["app_name"],
-        credentialsProvider=credentialsProvider,
         region_name=region_name,
         **kwargs,
     )

Clean up deprecated Java libs for STS integration with Kinesis client. 🧹 

This code dates back to the very early days, when parts of the Kinesis client utils were used to connect to Kinesis streams in real AWS (using IAM/STS tokens). This is no longer required today, and should be removed.

We have recently also seen some users running into issues with the Java compilation in local dev mode - removing it should hopefully simplify the installation a bit further.