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

Basic Authentication Is Not Working #218

Open
Abshan opened this issue Jul 17, 2023 · 0 comments · May be fixed by #219
Open

Basic Authentication Is Not Working #218

Abshan opened this issue Jul 17, 2023 · 0 comments · May be fixed by #219

Comments

@Abshan
Copy link

Abshan commented Jul 17, 2023

Description:
The Basic Authentication mechanism is not working as expected, and this behaviour is observed in SI-4.X versions when tested locally.
For example, when we use the http-call sink method with Basic Auth enabled as shown below, the Base64 encoded username and password is getting malformed.

@sink(type='http-call', sink.id='D1', publisher.url='http://localhost:8281/foobar/1.0', method='POST', basic.auth.username='admin', basic.auth.password='admin',
headers='Content-Type: application/json', ...,

When we checked the wirelogs from the backend service, we observed that the Authorization header value being sent to the backend was incorrect,
"Authorization: Basic UnpooledHeapByteBuf(ridx: 0, widx: 11, cap: 11/11)[\r][\n]"
Seems like there is an issue with the Base64 encoding of the Authorization header at [1]. The encoded header is in bytes and it needs to be converted to string through byte methods which causes the incorrect value to get assigned as the Authorization header. Since the encoded username and password value are invalid, the http-call sink method fails.

[1]

this.authorizationHeader = HttpConstants.AUTHORIZATION_METHOD + Base64.encode

Steps to reproduce:

  1. Create a backend with Basic Auth enabled
  2. Create a Siddhi App which calls the above backend using an http-call sink method with Basic Auth.
  3. When invoked, the Basic Auth mechanism will fail due to the improper encoded username and password.

Affected Product Version:

  • Streaming-Integrator-4.X.X
@lasanthaS lasanthaS linked a pull request Jul 19, 2023 that will close this issue
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.

1 participant