Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.TreeSet;
import java.util.stream.Collectors;

import org.keycloak.Config;
import org.keycloak.authentication.ClientAuthenticator;
import org.keycloak.authentication.ClientAuthenticatorFactory;
import org.keycloak.common.Profile;
Expand Down Expand Up @@ -415,7 +416,7 @@ private Map<String, Object> getClientCredentialsAdapterConfig(ClientModel client
private boolean isInternalClient(String realmName, String clientId) {
if (defaultClients.contains(clientId)) return true;

if (!"master".equals(realmName)) {
if (!Config.getAdminRealm().equals(realmName)) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. You're right that InternalClientManagementTest runs with the default admin realm and doesn't exercise client deletion, so it wouldn't guard this path.

The fix itself is a minimal alignment with the Config.getAdminRealm() idiom already used across the codebase (e.g. ApplianceBootstrap, MgmtPermissions, ModelToRepresentation) — behaviour is unchanged on the default master realm.

A regression test here needs the server booted with a non-default admin realm (a server-level option, not a per-test realm setup) and then asserts that removeClient refuses to delete a -realm client in that realm. I'm happy to add that as a @KeycloakIntegrationTest with a custom KeycloakServerConfig; let me know if you'd prefer it in this PR or a follow-up.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaurav0107 in this PR would be good.

@rmartinc rmartinc Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaurav0107 I don't think we really need a test for this. We are using the same in a lot of places and I don't think we need a explicit test. Just checking everything is OK to me. If you really want to do the test you can file a follow-up issue and send a new PR. I rebased the PR and started the CI. If CI passes this is OK to me and we can proceed with it.

return false;
}

Expand Down
Loading