Search in sources :

Example 1 with SystemPropertiesJsonParserFactory

use of org.keycloak.util.SystemPropertiesJsonParserFactory in project keycloak by keycloak.

the class KeycloakDeploymentBuilder method loadAdapterConfig.

public static AdapterConfig loadAdapterConfig(InputStream is) {
    ObjectMapper mapper = new ObjectMapper(new SystemPropertiesJsonParserFactory());
    mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
    AdapterConfig adapterConfig;
    try {
        adapterConfig = mapper.readValue(is, AdapterConfig.class);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    return adapterConfig;
}
Also used : SystemPropertiesJsonParserFactory(org.keycloak.util.SystemPropertiesJsonParserFactory) AdapterConfig(org.keycloak.representations.adapters.config.AdapterConfig) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with SystemPropertiesJsonParserFactory

use of org.keycloak.util.SystemPropertiesJsonParserFactory in project keycloak by keycloak.

the class AuthzClient method create.

/**
 * <p>Creates a new instance.
 *
 * @param configStream the input stream with the configuration data
 * @return a new instance
 */
public static AuthzClient create(InputStream configStream) throws RuntimeException {
    if (configStream == null) {
        throw new IllegalArgumentException("Config input stream can not be null");
    }
    try {
        ObjectMapper mapper = new ObjectMapper(new SystemPropertiesJsonParserFactory());
        mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
        return create(mapper.readValue(configStream, Configuration.class));
    } catch (IOException e) {
        throw new RuntimeException("Could not parse configuration.", e);
    }
}
Also used : SystemPropertiesJsonParserFactory(org.keycloak.util.SystemPropertiesJsonParserFactory) ServerConfiguration(org.keycloak.authorization.client.representation.ServerConfiguration) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 SystemPropertiesJsonParserFactory (org.keycloak.util.SystemPropertiesJsonParserFactory)2 ServerConfiguration (org.keycloak.authorization.client.representation.ServerConfiguration)1 AdapterConfig (org.keycloak.representations.adapters.config.AdapterConfig)1