Philippus / elastic4s

🔍 Elasticsearch Scala Client - Reactive, Non Blocking, Type Safe, HTTP Client
Apache License 2.0
1.64k stars 695 forks source link

Support authentication on the level of ElasticClient #3124

Closed igor-vovk closed 2 weeks ago

igor-vovk commented 3 months ago

Addresses https://github.com/Philippus/elastic4s/issues/3122. I copied authentication settings that were introduced in http4s PR https://github.com/Philippus/elastic4s/pull/3118, will be happy to remove them from http4s PR after this will be merged.

Also, they are now can be removed from AkkaHttpClient, that also implements adding credentials by itself.

By defining credentials on the ElasticClient level there is now a single place where credentials are used, so there is no need to rely on client-specific implementations of credential passing.

igor-vovk commented 3 weeks ago

Sorry @Philippus I haven't added tests yet. I was thinking whether I should make an IT-test, e.g. try to setup a credentials in ES, and then test against it, or just do a unit test? I was kind of blocked by not being able to choose, maybe you could share what would be the preferred way? Will be happy to add tests after ☺️

Philippus commented 3 weeks ago

Sorry @Philippus I haven't added tests yet. I was thinking whether I should make an IT-test, e.g. try to setup a credentials in ES, and then test against it, or just do a unit test? I was kind of blocked by not being able to choose, maybe you could share what would be the preferred way? Will be happy to add tests after ☺️

I think ideally, set up an Elasticsearch test container requiring credentials and test against that. But I don't know how easy it would be to set that up. I'm fine with someone adding that in a later PR.