-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
help request: Parse $request_body and add authorization header when using websockets #8466
Comments
has supported by #8336, would release in next version |
I do not quite understand, you can describe more detailed. |
authz-keycloak uses the authorization header in the requests allowing apisix to validate with Keycloak the permissions and thus decide whether to let the request through or return an error saying that it does not have the necessary permissions. This works great, except for websockets because websockets don't have this authorization header that the plugin uses. So, we are adding the authorization header as part of the request body, and not in the header. So, we need to somehow rewrite the request, taking the token from the request body and putting it in the header before the authz-keycloak plugin does its job. The problem is that in addition to the header, we are adding more information in the request body so that we need to parse the content of the request body and extract only the JWT. This is what we have thought to do, however, it is a good opportunity to see if there is any other approach. How to authorize websockets with Keycloak and Apisix if Websockets don't use authorization header? |
Do you mean extracting credentials from websocket frames, or just the request body in the 101 handshake request? |
From the request body. |
We have some options to achieve this.
|
Thanks for the help, but apparently our needs are not explained very well here, and therefore I will open a new one. |
Description
We are adding a Keycloak integration with Apisix. For this we are using authz-keycloak. Our platform makes use of websockets and therefore it is impossible for us to add in the Authorization header causing the request to fail.
Before implementing Apisix, we have been passing this header in the websocket payload, and now we want to use proxy-rewrite to somehow extract the Authorization header that is being sent in the message and add it in the headers.
And now we have two problems:
e.g.
Environment
apisix version
):uname -a
):openresty -V
ornginx -V
):curl http://127.0.0.1:9090/v1/server_info
):luarocks --version
):The text was updated successfully, but these errors were encountered: