fix: correcting how provider default is found (#41678) (#41697)

closes: #41677


(cherry picked from commit 5731cdf6738bc4344d495bd1193fe531f4f7ed7a)

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
Steven Hawkins 2025-08-06 08:30:59 -04:00 committed by GitHub
parent 1b5e05c8f5
commit d7630b0cea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 5 deletions

View File

@ -180,10 +180,10 @@ public final class Configuration {
for (int i = 0; i < key.length(); i++) {
char c = key.charAt(i);
if (c == ',') {
c = '-'; // should not happen, but was allowed by the previous logic
}
if (l && Character.isUpperCase(c)) {
if (c == '.') {
c = '-'; // this is not documented, but was in the previous logic
l = false;
} else if (l && Character.isUpperCase(c)) {
sb.append('-');
c = Character.toLowerCase(c);
l = false;

View File

@ -52,7 +52,7 @@ public class MicroProfileConfigProvider implements Config.ConfigProvider {
@Override
public String getDefaultProvider(String spi) {
return scope(spi).get("provider.default");
return scope(spi).get("provider-default");
}
@Override

View File

@ -187,6 +187,20 @@ public class ConfigurationTest extends AbstractConfigurationTest {
assertEquals("true", createConfig().getConfigValue("kc.proxy-allow-forwarded-header").getValue());
}
@Test
public void testProviderDefault() {
ConfigArgsConfigSource.setCliArgs("--spi-client-registration--provider-default=openid-connect");
initConfig("client-registration");
assertEquals("openid-connect", Config.getDefaultProvider("client-registration"));
}
@Test
public void testScopePropertyWithPeriod() {
ConfigArgsConfigSource.setCliArgs("--spi-client-registration--openid-connect--some-property=value");
Config.Scope scope = initConfig("client-registration", "openid-connect");
assertEquals("value", scope.get("some.property"));
}
@Test
public void testPropertyNamesFromConfig() {
ConfigArgsConfigSource.setCliArgs("--spi-client-registration-openid-connect-static-jwk-url=http://c.jwk.url");