Java Code Examples for org.keycloak.Config#ConfigProvider

The following examples show how to use org.keycloak.Config#ConfigProvider . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DMRConfigProviderFactory.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Override
public Optional<Config.ConfigProvider> create() {

    ServletContext context = Resteasy.getContextData(ServletContext.class);

    JsonNode node = null;

    try {
        String dmrConfig = loadDmrConfig(context);
        if (dmrConfig != null) {
            node = JsonSerialization.mapper.readTree(dmrConfig);
            ServicesLogger.LOGGER.loadingFrom("standalone.xml or domain.xml");
        }
    } catch (IOException e) {
        LOG.warn("Failed to load DMR config", e);
    }

    return createJsonProvider(node);

}
 
Example 2
Source File: JsonConfigProviderFactory.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public Optional<Config.ConfigProvider> create() {

    JsonNode node = null;

    try {
        String configDir = System.getProperty("jboss.server.config.dir");
        if (configDir != null) {
            File f = new File(configDir + File.separator + "keycloak-server.json");
            if (f.isFile()) {
                ServicesLogger.LOGGER.loadingFrom(f.getAbsolutePath());
                node = JsonSerialization.mapper.readTree(f);
            }
        }

        if (node == null) {
            URL resource = Thread.currentThread().getContextClassLoader().getResource("META-INF/keycloak-server.json");
            if (resource != null) {
                ServicesLogger.LOGGER.loadingFrom(resource);
                node = JsonSerialization.mapper.readTree(resource);
            }
        }
    } catch (IOException e) {
        LOG.warn("Failed to load JSON config", e);
    }

    return createJsonProvider(node);

}
 
Example 3
Source File: JsonConfigProviderFactory.java    From keycloak with Apache License 2.0 4 votes vote down vote up
protected Optional<Config.ConfigProvider> createJsonProvider(JsonNode node) {
    return Optional.ofNullable(node).map(n -> new JsonConfigProvider(n, getProperties()));
}
 
Example 4
Source File: MicroProfileConfigProviderFactory.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public Optional<Config.ConfigProvider> create() {
    return Optional.of(new MicroProfileConfigProvider());
}
 
Example 5
Source File: ConfigProviderFactory.java    From keycloak with Apache License 2.0 votes vote down vote up
Optional<Config.ConfigProvider> create();