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

elasticsearch-search-source won't let me define basic authentication #1056

Closed
MarcoMartins86 opened this issue Sep 29, 2022 · 8 comments · Fixed by #1057
Closed

elasticsearch-search-source won't let me define basic authentication #1056

MarcoMartins86 opened this issue Sep 29, 2022 · 8 comments · Fixed by #1057
Milestone

Comments

@MarcoMartins86
Copy link
Contributor

While trying to set the basic authentication (user, password) I got the error Unknown parameters=[{password=xxxxxx, user=xxxxxx}] I think the bug is really on Camel repository but I can't open an issue there.

The reason I think it's a bug there is that the documentation says that user and password are options but when I try to define a route directly (without using the kamelet), elasticsearch-rest://clusterName?password=xxxxxx&user=xxxxxx gives me the same error.

I've tried to debug the problem and notice that on ElasticsearchEndpointConfigurer.java the user and password are not present on the switches cases, all other options are, but maybe this is on purpose since these are the only ones with @Metadata(secret = true) on ElasticsearchComponent.java.
Also, if ElasticsearchEndpoint class @UriEndpoint annotation had the flag lenientProperties = true, it would skip the validation where the error originates, but dunno if it would then configure the user and password options with the correct value.

Or maybe it's just me that is missing something and can't get this to work on camel-quarkus.

@oscerd
Copy link
Contributor

oscerd commented Sep 29, 2022

I don't think this is right project to ask: if it's related to camel-quarkus you should open an issue there in the issue tracker on Github. If it's a problem at Camel level you should open an issue at https://issues.apache.org/jira/browse/CAMEL

By the way it's not a bug. You need to set the user and password at component level. This means you cannot append user and password to endpoint URI. Instead you should either define:

camel.component.elasticsearch-rest.user 
camel.component.elasticsearch-rest.password

in your application properties file. Or you should create a component and use it directly like this snippet:

https://camel.netlify.app/components/latest/elasticsearch-rest-component.html#_configure_the_component_and_enable_basic_authentication

This issue doesn't report the version you're using. By the way the solution should be what I wrote.

For sure this is not something related to Kamelets.

I'm going to close this.

@oscerd oscerd closed this as completed Sep 29, 2022
@MarcoMartins86
Copy link
Contributor Author

Thank you for your replay, nevertheless, if user and password can't be a query parameter and are only set that way, should they be present as optional on the kamelet definition? Because as soon as they have a value, there will be a parse error (just tested with plain camel to discard quarkus issue).

@oscerd
Copy link
Contributor

oscerd commented Sep 29, 2022

I need a bit more information: what are you using? And how are you using? You shouldn't specify the user and password as URI parameter, because they are not parameters of endpoint. They work only at component level.

But please give some more context, a snippet of code, what you are using and how and all the used version. Otherwise it's impossible to answer

@MarcoMartins86
Copy link
Contributor Author

On the elasticsearch-search-source kamelet:

- to:
            uri: "{{local-es}}:{{clusterName}}"
            parameters:
              operation: "SEARCH"
              indexName: "{{indexName}}"
              hostAddresses: "{{hostAddresses}}"
              enableSSL: "{{enableSSL}}"
              user: "{{?user}}"
              password: "{{?password}}"

The user and password are defined as query parameters if I am understanding correctly but they will never work since as you said they will only work at component level.

@oscerd
Copy link
Contributor

oscerd commented Sep 29, 2022

That's wrong. It should be defined on the bean. Thanks for reporting, now I'm getting the problem.

@oscerd oscerd reopened this Sep 29, 2022
@oscerd oscerd added this to the 0.10.0 milestone Sep 29, 2022
@oscerd
Copy link
Contributor

oscerd commented Sep 29, 2022

We are about to release 0.9.1 for releasing camel-k 1.10.1, I will include the fix for this. Sorry for not understanding immediately the question.

@MarcoMartins86
Copy link
Contributor Author

No problem thanks for coping with this issue with me.

@oscerd
Copy link
Contributor

oscerd commented Sep 29, 2022

I'm sorry I didn't get from the beginning.

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