Wrong path generated by Keycloak admin client reactive resulting in 404
See original GitHub issueDescribe the bug
When using quarkus-keycloak-admin-client-reactive, requests being sent to keycloak to manage resources (auth seems ok since no 401) are returning 404. When looking at TRACE logs to understand what’s happening, I see that the path is not formatted correctly (e.g. http://localhost:8180/admin/realms/myrealm/clients/clients to list clients). Same thing with roles for where the resource type appears two times in the path.
When switching to quarkus-keycloak-admin-client (non-reactive version) extension, everything seems fine. I guess there is a difference between to two. There is not much code is those two extensions in this repository but I couldn’t figure out where it breaks. The non-reactive version seems to have some more dependencies. Details below.
Expected behavior
Path should be formatted correctly in order not to return 404
Actual behavior
Created paths that targets resources are not matching the Keycloak REST API specifications (17.0.1)
How to Reproduce?
Quarkus with quarkus-keycloak-admin-client-reactive
@Inject
keycloakConfig config;
@ApplicationScoped
Keycloak keycloak() {
return KeycloakBuilder.builder()
.serverUrl(config.serverUrl())
.realm(config.realm())
.grantType(OAuth2Constants.CLIENT_CREDENTIALS)
.clientId(config.clientId())
.clientSecret(config.clientSecret())
.build();
}
List<ClientRepresentation> r = keycloak.realm("myrealm").clients().findAll();
Dependencies versions
# When using reactive version
❯ mvn dependency:tree | grep keyc
[INFO] +- io.quarkus:quarkus-keycloak-admin-client-reactive:jar:2.8.0.Final:compile
[INFO] | +- org.keycloak:keycloak-core:jar:17.0.1:compile
[INFO] | | +- org.keycloak:keycloak-common:jar:17.0.1:compile
[INFO] | +- org.keycloak:keycloak-admin-client:jar:17.0.1:compile
# When using non-reactive version
❯ mvn dependency:tree | grep keyc
[INFO] +- io.quarkus:quarkus-keycloak-admin-client:jar:2.8.0.Final:compile
[INFO] | +- org.keycloak:keycloak-adapter-core:jar:17.0.1:compile
[INFO] | +- org.keycloak:keycloak-core:jar:17.0.1:compile
[INFO] | | +- org.keycloak:keycloak-common:jar:17.0.1:compile
[INFO] | +- org.keycloak:keycloak-admin-client:jar:17.0.1:compile
[INFO] | +- org.keycloak:keycloak-authz-client:jar:17.0.1:compile
docker
docker run --rm -p 8180:8080 -e KEYCLOAK_ADMIN=admin -e KC_HTTP_ENABLED=true -e \
KEYCLOAK_ADMIN_PASSWORD=admin -e KC_HOSTNAME_STRICT=false --name kc \
quay.io/keycloak/keycloak:17.0.1 start
Output of uname -a or ver
Linux REDACTED 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
openjdk version “17.0.2” 2022-01-18 OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8) OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.8.0.Final
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.6.3
Additional information
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Related StackOverflow Question
should be fixed in https://github.com/quarkusio/quarkus/pull/25131
docker run --rm -p 8180:8080 -e KEYCLOAK_ADMIN=admin -e KC_HTTP_ENABLED=true -e KEYCLOAK_ADMIN_PASSWORD=admin -e KC_HOSTNAME_STRICT=false --name kc quay.io/keycloak/keycloak:17.0.1 start-devrealm-managementandaccountclient roles (for the sake of example)tar -xvzf realm-app.tar.gzandcd realmquarkus devcurl http://localhost:8080/testYou should get get :
Response: GET http://localhost:8180/admin/realms/myrealm/clients/clients, Status[404 Not Found],