mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-10 15:32:05 -03:30
Keystore location does not work for Windows (#23209)
* Keystore location does not work for Windows Fixes #22185 * Enable Quarkus UT for Windows Closes #23208
This commit is contained in:
parent
5603ee7b46
commit
c2fc2c2b03
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -126,7 +126,10 @@ jobs:
|
||||
name: Quarkus UT
|
||||
needs: build
|
||||
timeout-minutes: 15
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest, windows-latest ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ import org.keycloak.config.ConfigKeystoreOptions;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.keycloak.quarkus.runtime.configuration.mappers.PropertyMapper.fromOption;
|
||||
@ -50,11 +49,12 @@ final class ConfigKeystorePropertyMappers {
|
||||
throw new IllegalArgumentException("config-keystore-password must be specified");
|
||||
}
|
||||
|
||||
Optional<String> realPath = Optional.of(String.valueOf(Paths.get(path.getValue()).toAbsolutePath().normalize()));
|
||||
if (!Files.exists(Path.of(realPath.get()))) {
|
||||
throw new IllegalArgumentException("config-keystore path does not exist: " + realPath.get());
|
||||
final Path realPath = Path.of(path.getValue()).toAbsolutePath().normalize();
|
||||
if (!Files.exists(realPath)) {
|
||||
throw new IllegalArgumentException("config-keystore path does not exist: " + realPath);
|
||||
}
|
||||
return realPath;
|
||||
|
||||
return Optional.of(realPath.toUri().toString());
|
||||
}
|
||||
|
||||
private static Optional<String> validatePassword(Optional<String> option, ConfigSourceInterceptorContext context) {
|
||||
|
||||
@ -20,10 +20,11 @@ package org.keycloak.quarkus.runtime.configuration.test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.keycloak.quarkus.runtime.Environment.isWindows;
|
||||
import static org.keycloak.quarkus.runtime.configuration.ConfigArgsConfigSource.CLI_ARGS;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@ -266,7 +267,14 @@ public class ConfigurationTest {
|
||||
System.setProperty(CLI_ARGS, "--db=dev-file");
|
||||
SmallRyeConfig config = createConfig();
|
||||
assertEquals(H2Dialect.class.getName(), config.getConfigValue("kc.db-dialect").getValue());
|
||||
assertEquals("jdbc:h2:file:" + System.getProperty("user.home") + "/data/h2/keycloakdb;;AUTO_SERVER=TRUE;NON_KEYWORDS=VALUE", config.getConfigValue("quarkus.datasource.jdbc.url").getValue());
|
||||
|
||||
// JDBC location treated as file:// URI
|
||||
final String userHomeUri = Path.of(System.getProperty("user.home"))
|
||||
.toUri()
|
||||
.toString()
|
||||
.replaceFirst(isWindows() ? "file:///" : "file://", "");
|
||||
|
||||
assertEquals("jdbc:h2:file:" + userHomeUri + "data/h2/keycloakdb;;AUTO_SERVER=TRUE;NON_KEYWORDS=VALUE", config.getConfigValue("quarkus.datasource.jdbc.url").getValue());
|
||||
|
||||
System.setProperty(CLI_ARGS, "--db=dev-mem");
|
||||
config = createConfig();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user