oci-go-sdk icon indicating copy to clipboard operation
oci-go-sdk copied to clipboard

[Feature] Allow use private key to be outside of a file

Open GustavoOS opened this issue 1 year ago • 3 comments

Currently, common.ConfigurationProviderEnvironmentVariables takes a private key path. Also, the default option looks for the .oci file under a specific folder Would it be possible to add an option that allows private key string to be used to authenticate?

GustavoOS avatar Nov 02 '24 20:11 GustavoOS

Hi @GustavoOS - Can you explain what is the usecase of passing a key string and not the file path ? We do not do that due to security concerns.

jyotisaini avatar Nov 05 '24 00:11 jyotisaini

I have a Vercel Function written in Golang that I wish to create a bucket inside Object Storage with auto tiering. As that function is not hosted in OCI, the only way to authenticate it is to have the key inside a secret vault or using Vercel Environment variables.

The reason i have to do it with oracle sdk is because AWS Intelligent tiering maps to standard tier instead of auto tiering when using S3 compatibility API.

From my perspective, either way could solve my problem:

  1. Changing compatibility API so Intelligent Tiering maps to Auto Tiering
  2. Enabling the key to be hosted outside of a file

GustavoOS avatar Nov 05 '24 11:11 GustavoOS

@GustavoOS You might want to look at the NewRawConfigurationProvider instead. Just lookup the env variables in your code use the following. NOTE: here the privateKey is the contents of a private key file.

provider := common.NewRawConfigurationProvider(
	tenancy,
	user,
	region,
	fingerprint,
	privateKey,
	nil,
)

ianeal avatar Nov 22 '24 16:11 ianeal