Add support for dynamically adding `redirect-uri` to keycloak configuration
Reason/Context
- As we have successfully implemented
sso-based logininmicrocks-cliwe have to redirect the user to specific port where a server started by the CLI is waiting for the response of authentication from Keycloak. - Currently, we are adding only one redirect-uri which is the URI of the microcks server.
Description
- We have to add the server-address/redirect-URL into the Keycloak configuration, otherwise keycloak will not allow that authentication request from the CLI
- As
adminwe should have a privilege to add the redirect-uri dynamically.
Implementation ideas
No response
Hey @Harsh4902 , thanks for opening this one.
I don't think we would be able to dynamically add new redirect-uris in Keycloak realm config but we can at least add a new entry for a well-known port on localhost or for a range of port if the CLI is using a dynamic port attribution. How did you manage this on the CLI side?
BTW I wonder what would be the better way of doing this: adding a new redirect-uri in the microcks-app-js client definition of the realm OR adding a brand new microcks-cli client to better isolate use-cases? What do you think?
Hey @Harsh4902 , thanks for opening this one.
I don't think we would be able to dynamically add new
redirect-uris in Keycloak realm config but we can at least add a new entry for a well-known port onlocalhostor for a range of port if the CLI is using a dynamic port attribution. How did you manage this on the CLI side?BTW I wonder what would be the better way of doing this: adding a new
redirect-uriin themicrocks-app-jsclient definition of the realm OR adding a brand newmicrocks-cliclient to better isolate use-cases? What do you think?
Okay, we are using 8085 as the default port for the callback server of microcks-cli, and we are providing this realm configuration only in install/docker-compose/. So, I think we can add localhost:8085 as a redirect-uri. The use cases for both apps are almost similar, so I think there is no need to add a new microcks-cli client in the realm.
we are providing this realm configuration only in install/docker-compose/
We also have to add it in the configuration that is spawn by the Helm chart and the Operator.
8085 is a bit "close" to 8585 we put as an example for locally running Microcks. And also maybe subject to conflicts with locally running web-app. Couldn't we choose something more "original"?
we are providing this realm configuration only in install/docker-compose/
We also have to add it in the configuration that is spawn by the Helm chart and the Operator.
8085is a bit "close" to8585we put as an example for locally running Microcks. And also maybe subject to conflicts with locally running web-app. Couldn't we choose something more "original"?
Okay, let me check for rarely used ports and will update it in the CLI.
Okay, let me check for rarely used ports and will update it in the CLI.
Hey @Harsh4902 Did you get some time looking at this one? It could be cool to push the CLI and have this one prepared.
@lbroudoux Oh! I missed this. Can we use 58085? I searched about this port but didn't find any usage, so maybe it can be our unique+original
Now done!
Oh! Great 🎉. I am updating it in the CLI's code.