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

[BUG] Authorization headers is changed even if tokenManager is disabled #120

Closed
StenGruener opened this issue Nov 26, 2024 · 6 comments · Fixed by #214
Closed

[BUG] Authorization headers is changed even if tokenManager is disabled #120

StenGruener opened this issue Nov 26, 2024 · 6 comments · Fixed by #214
Labels
bug Something isn't working

Comments

@StenGruener
Copy link

Describe the bug
In our setup we use basic auth = username/pass protected endpoints. New versions of web-ui break do not support this auth, since Authorization header is always set to Bearer even if tokenManager is disabled

To Reproduce
Steps to reproduce the behavior:

  1. Select no token
  2. Do requests
  3. Observe "Authorization: Bearer " header in requests

Expected behavior
I expect that the Authorization Headers part is not changed/set by gui if tokens are disabled.

Additional context
I guess that a check for this.authStore.getAuthEnabled() needs to be added somewhere here:

headers.set('Authorization', 'Bearer ' + this.authStore.getToken);

@StenGruener StenGruener added the bug Something isn't working label Nov 26, 2024
@aaronzi aaronzi moved this from To triage to Ready in Support Requests Nov 27, 2024
@aaronzi
Copy link
Member

aaronzi commented Nov 27, 2024

Hi @StenGruener,

thank you for informing us about this oversight. We will have a look and will implement this fix.

@StenGruener
Copy link
Author

StenGruener commented Jan 14, 2025

@aaronzi i guess it is not good enougth for us :) I would like to just passthorugh the header from the browser without touching it (browsers will do if REST endpoints are on the same domain as the aas-gui) . I do not want to store auth information within env configuration.

Ideally, you colud add an additional option like "VITE_NO_AUTH_HEADER_INJECTON" where you just return from addAuthorizationHeader function or do not call it directly. So no mangling of authentication field in header required
image

@aaronzi
Copy link
Member

aaronzi commented Jan 15, 2025

Hi @StenGruener,

I'm not sure if I understand which changes would be necessary in your opinion. The current implementation checks if either RBAC or basic auth is active. If neither is activated, the provided header is just returned? Why do I need a new env variable?

Reference to the Code:

function addAuthorizationHeader(headers: Headers): Headers {
if (authStore.getAuthStatus) {
headers.set('Authorization', 'Bearer ' + authStore.getToken);
return headers;
} else if (envStore.getBasicAuthActive) {
headers.set(
'Authorization',
'Basic ' + btoa(envStore.getBasicAuthUsername + ':' + envStore.getBasicAuthPassword)
);
return headers;
} else {
return headers;
}
}

@StenGruener
Copy link
Author

oh, maybe i have overlooked the else in line 301 in a hurry, yesterday. Will try out today on our system and report.

@StenGruener
Copy link
Author

yea, works as expected, big thanks and sorry for false alarm!

@aaronzi
Copy link
Member

aaronzi commented Jan 15, 2025

Happy to hear that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants