-
Notifications
You must be signed in to change notification settings - Fork 8k
Use back keycloak-js instead of initiate login in the backend for account #42035
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
Conversation
…ount Closes keycloak#40463 Signed-off-by: rmartinc <[email protected]>
|
@rmartinc I am moving this out of draft in your absence, I agree with the approach here. I'll have some other reviewers check this out as well. |
pedroigor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree about the mess. The discussions at that time were basically changing UIs vs backend, whereas the UI was, in theory, too hard to change in order to avoid rendering the React app when users are not yet authenticated.
If we are still handling errors properly and the spinner is shown instead of initing the React app, LGTM.
…ount (keycloak#42035) Closes keycloak#40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
…ount (keycloak#42035) Closes keycloak#40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
…ount (keycloak#42035) Closes keycloak#40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
…ount (#42035) Closes #40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
…ount (#42035) Closes #40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
…ount (keycloak#42035) Closes keycloak#40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
…ount (keycloak#42035) Closes keycloak#40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
…ount (keycloak#42035) Closes keycloak#40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
…ount (keycloak#42035) Closes keycloak#40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
…ount (keycloak#42035) Closes keycloak#40463 Signed-off-by: rmartinc <[email protected]> (cherry picked from commit 360ff70)
Closes #40463
After checking this I think the only way of doing this OK without changing things a lot is going back and use
keycloak-jsnormally again. If I understood this correctly, the initial issue #31469 was reported because the console was displayed empty, and the login was requested later when the login was required for the first request (401). This PR does the following:keycloak-jsto login again (automatically now because cookies are in place), but it was a second round-trip in events. The JS part cannot use the state or code verifier generated by the backend. It makes no sense.ui-sharedalways initiates the login if not already authenticated. This way nothing is displayed (just thespinner) and if the redirect is needed, from the spinner you go to the login page. Nothing is shown except the spinner if you are not logged in. The shared part is used for both consoles (admin and account).keycloak-jsis used we need a real browse (firefox or chrome) to execute the JS needed to login. I have changed those tests to use other thing instead of the account console.AccountConsoleTestis the only test that really checks the account functionality This one is moved to theformspackage to be used with firefox and chrome. The scopes are correctly respected. The only little difference is that thekeycloak-jsalways addsopenid, but I think that this is OK.error_descriptionreturned. The only error accepted now is a JSErroror theerrorgenerated byekeycloak-js. As theerroris standard I have provided the translations for it, and only the standard errors are displayed. Other unknown error uses always the same message.It's a draft for now. Because maybe you see another approach (but I really don't see anything better than this).