0

I am trying to connect to AWS Glue Schema registry and would like to use WebIdentityTokenFileCredentialsProvider. As part of it, I tried the following in my custom serializer class ( extends GlueSchemaRegistryKafkaSerializer )

 WebIdentityTokenFileCredentialsProvider.create();

This would return me an error saying

 software.amazon.awssdk.core.exception.SdkClientException:Multiple HTTP Implementation found in class path 

To avoid this, I tried using StsWebIdentityTokenFileCredentialsProvider where I can get hang of choosing a HTTP client

SdkHttpClient httpClient = ApacheHttpClient.builder().build();
StsClient stsClient = StsClient.builder().region(Region.<region_name>).httpClient(httpClient).build();
StsWebIdentityTokenFileCredentialsProvider stsWebIdentityTokenFileCredentialsProvider = StsWebIdentityTokenFileCredentialsProvider
        .builder()
        .stsClient(stsClient)
        .build();
            

With this approach, I am stuck with the following error:

software.amazon.awssdk.core.exception.SdkClientException: Unable to load credentials from system settings. Access key must be specified either via environment variable (AWS_ACCESS_KEY_ID) or system property (aws.accessKeyId).

The issue is that I cannot provide hardcoded values to system properties/environment variables as I work in an enterprise.

More details:

I see from AWS logs that TLS handshake is successful and secure connection is established. Then it tries to do the following "Loading credentials from WebIdentityTokenCredentialsProvider" and I get the above exception.

Can someone help me how I can connect to the Glue Schema registry with fetching credentials from WebIdentityTokenCredentialsProvider ?

Edit: Code snippet on how I am trying to fetch:

A custom class ( CustomSerializer) extends GlueSchemaRegistryKafkaSerializer and the constructor of the extended class looks something like this:

 public CustomSerializer()
{ 
super( stsWebIdentityTokenFileCredentialsProvider(),null,null); 
}

    public static StsWebIdentityTokenFileCredentialsProvider stsWebIdentityTokenFileCredentialsProvider(){

   
        SdkHttpClient httpClient = ApacheHttpClient.builder().build();
        StsClient stsClient = StsClient.builder().region(Region.<region_name>).httpClient(httpClient).build();


        StsWebIdentityTokenFileCredentialsProvider stsWebIdentityTokenFileCredentialsProvider = StsWebIdentityTokenFileCredentialsProvider
                .builder()
                .stsClient(stsClient)
                .build();
        return  stsWebIdentityTokenFileCredentialsProvider;


    } 

0 Answers0