spring-cloud / spring-cloud-vault

Configuration Integration with HashiCorp Vault
http://cloud.spring.io/spring-cloud-vault/
Apache License 2.0
270 stars 151 forks source link

Unable to configure regionProvider for awsIamAuthentication? #679

Closed handcarbon closed 1 year ago

handcarbon commented 1 year ago

There doesn't seem to be a way how to autowire custom awsRegionProvider for iamAuthentication?

    private ClientAuthentication awsIamAuthentication(VaultProperties vaultProperties) {
        VaultProperties.AwsIamProperties awsIam = vaultProperties.getAwsIam();
        AwsCredentialsProvider credentialsProvider = ClientAuthenticationFactory.AwsCredentialProvider.getAwsCredentialsProvider();
        AwsIamAuthenticationOptions.AwsIamAuthenticationOptionsBuilder builder = AwsIamAuthenticationOptions.builder();
        if (StringUtils.hasText(awsIam.getRole())) {
            builder.role(awsIam.getRole());
        }

        if (StringUtils.hasText(awsIam.getServerName())) {
            builder.serverName(awsIam.getServerName());
        }

        if (awsIam.getEndpointUri() != null) {
            builder.endpointUri(awsIam.getEndpointUri());
        }

        builder.path(awsIam.getAwsPath()).credentialsProvider(credentialsProvider);
        AwsIamAuthenticationOptions options = builder.credentialsProvider(credentialsProvider).build();
        return new AwsIamAuthentication(options, this.restOperations);
    }

Only option is to build ClientAuthentication bean by myself?

mp911de commented 1 year ago

Fixed via #681