Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a possibility to handle session credentials in live. #353

Closed
Wosin opened this issue Oct 26, 2022 · 5 comments · Fixed by #354
Closed

Add a possibility to handle session credentials in live. #353

Wosin opened this issue Oct 26, 2022 · 5 comments · Fixed by #354

Comments

@Wosin
Copy link

Wosin commented Oct 26, 2022

There is currently a method called def live(region: Region, credentials: AwsCredentials, uriEndpoint: Option[URI] = None) which will only use the accessKeyId and secretAccessKey when authenticating. This makes it impossible to use with e.g. SessionAwsCredentials which will return cryptic errors about keys not being present in the registry.

We could either add a special handling for SessionAwsCredentials or add a note in the documentation about this behavior.

@regis-leray
Copy link
Member

regis-leray commented Oct 27, 2022

@Wosin
Copy link
Author

Wosin commented Oct 28, 2022

Yeah, but if You pass AwsSessionCredentials which will be possible because they extend AwsCredentials it will ignore sessionToken and the authentication will fail.

@regis-leray
Copy link
Member

Good catch so please create a provider, and it will work
https://github.com/zio/zio-s3/blob/series/2.x/src/main/scala/zio/s3/providers.scala#L8

def session(accessKeyId: String, secretAccessKey: String, sessionToken: String): UManaged[AwsCredentialsProvider] =
    ZManaged.succeedNow[AwsCredentialsProvider](new AwsCredentialsProvider {
      override def resolveCredentials(): AwsCredentials = AwsSessionCredentials.create(accessKeyId, secretAccessKey, sessionToken)
    })

@regis-leray
Copy link
Member

I solved your problem, you can even use live() with aws session credentials :)

#354

@regis-leray
Copy link
Member

regis-leray commented Oct 29, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants