use of org.keycloak.adapters.KeycloakConfigResolver in project shinyproxy by openanalytics.
the class KeycloakAuthenticationBackend method adapterDeploymentContext.
@Bean
@ConditionalOnProperty(name = "shiny.proxy.authentication", havingValue = "keycloak")
protected AdapterDeploymentContext adapterDeploymentContext() throws Exception {
AdapterConfig cfg = new AdapterConfig();
cfg.setRealm(environment.getProperty("shiny.proxy.keycloak.realm"));
cfg.setAuthServerUrl(environment.getProperty("shiny.proxy.keycloak.auth-server-url"));
cfg.setResource(environment.getProperty("shiny.proxy.keycloak.resource"));
Map<String, Object> credentials = new HashMap<>();
credentials.put("secret", environment.getProperty("shiny.proxy.keycloak.credentials-secret"));
cfg.setCredentials(credentials);
KeycloakDeployment dep = KeycloakDeploymentBuilder.build(cfg);
AdapterDeploymentContextFactoryBean factoryBean = new AdapterDeploymentContextFactoryBean(new KeycloakConfigResolver() {
@Override
public KeycloakDeployment resolve(Request facade) {
return dep;
}
});
factoryBean.afterPropertiesSet();
return factoryBean.getObject();
}
Aggregations