-
Notifications
You must be signed in to change notification settings - Fork 330
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
Add root_url support to OpenID client #248
Conversation
Alright, once root_url is set, web_origins defaults to root_url and valid_redirect_uris to [root_url/*]. Should these values be implied by the provider itself or should an error be reported that things have to be configured manually? |
e99359e
to
7576468
Compare
I'm stuck here. If I declare |
Hey @languitar, I'm trying to reproduce the issue you're having but I'm having some trouble with it. I'm running Keycloak 8.0.1 locally, and when I set a root url on a client, it doesn't appear to modify any other url attributes for the client. Could you walk me through the steps you're taking to reproduce this? |
Thanks for the quick feedback. Here's the procedure to demonstrate this just using the GUI: docker run --rm -e KEYCLOAK_USER=keycloak -e KEYCLOAK_PASSWORD=password -p 8080:8080 jboss/keycloak:8.0.1 "-b" "0.0.0.0" "-Dkeycloak.profile.feature.upload_scripts=enabled" Then directly clicking "save" results in: However: results in: As you can see, three additional URLs in the bottom are pre-filled. This is also reflected in the output of the REST API: {
"id": "5279791e-4c41-42d0-8e8d-ff139d87208c",
"clientId": "withroot",
"rootUrl": "http://root",
"adminUrl": "http://root",
"surrogateAuthRequired": false,
"enabled": true,
"clientAuthenticatorType": "client-secret",
"redirectUris": [
"http://root/*"
],
"webOrigins": [
"http://root"
],
"notBefore": 0,
"bearerOnly": false,
"consentRequired": false,
"standardFlowEnabled": true,
"implicitFlowEnabled": false,
"directAccessGrantsEnabled": true,
"serviceAccountsEnabled": false,
"publicClient": true,
"frontchannelLogout": false,
"protocol": "openid-connect",
"attributes": {},
"authenticationFlowBindingOverrides": {},
"fullScopeAllowed": true,
"nodeReRegistrationTimeout": -1,
"defaultClientScopes": [
"web-origins",
"role_list",
"roles",
"profile",
"email"
],
"optionalClientScopes": [
"address",
"phone",
"offline_access",
"microprofile-jwt"
],
"access": {
"view": true,
"configure": true,
"manage": true
}
} |
Ah, I see. So it looks like this is only happening when a client is created, not updated. I assume that this happens to help the user understand what the root url is trying to do. This is a tricky one, but I think we can find a way around it. If I understand correctly, the problem you're running into is that when you use One solution to this problem is to update the I think the best solution to this problem is to use a string pointer for the The trick to this is to use So, when you create a Sorry for the long-winded explanation, I hope that makes sense. If you're still having trouble with this, I can try to make a commit against your branch to see if I can fix it. |
Thanks for the long and detailed explanations. However, I am still struggling to find a working solution (with my limited knowledge of Go and Keycloak). I have pushed what I have tried so far with pointers. But now a lot of tests end up in open changes on the various other URLs again:
If you have some time to take a look at how to solve this, that would be great. |
Thanks for giving that a shot. I went ahead and made some changes and pushed them to your branch. Would you mind building these changes and verifying that they work for your use case? |
Thanks for your help! I think one issue remains: even though keycloak initially creates an admin_url when using root_url, it is not required to have something in admin_url. Not specifying admin_url as well as using an empty string now results in "admin_url is required when root_url is given". We could probably live with that by specifying some dummy URL, but in theory it should be possible to have an empty field here. |
I think we can mark those url attributes as |
Sorry for the long delay. I don't think that would help either, because what I would want to create is a client that only has a root url but no admin url. This is simply not possible in one pass with the keycloak API. So I think the current behavior is probably the best thing we can do with this strange default behavior that is implemented in keycloak. So I'd be fine to leave the PR as it is. |
That works for me! Could you update your branch to resolve the merge conflicts? |
Alright, I have rebased this and squashed things into a single commit |
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.
LGTM - thanks for the PR!
Thanks for your help! |
I am trying to add the requested root_url support (#236) to the OpenID client. However, at least locally, tests fail after my changes and I don't understand the reason for that. Maybe someone has a helping hand on what is missing here?