All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.canoo.dp.impl.server.security.DolphinKeycloakConfigResolver Maven / Gradle / Ivy

Go to download

The Dolphin Platform is a framework that implements the presentation model pattern and provides amodern way to create enterprise applications. The Platform provides several client implementations that all canbe used in combination with a general sever API.

There is a newer version: 1.0.0.CR5
Show newest version
package com.canoo.dp.impl.server.security;

import org.keycloak.adapters.KeycloakConfigResolver;
import org.keycloak.adapters.KeycloakDeployment;
import org.keycloak.adapters.KeycloakDeploymentBuilder;
import org.keycloak.adapters.spi.HttpFacade;
import org.keycloak.representations.adapters.config.AdapterConfig;

public class DolphinKeycloakConfigResolver implements KeycloakConfigResolver {

    private static KeycloakConfiguration configuration;

    public KeycloakDeployment resolve(final HttpFacade.Request request) {

        //keycloak.auth-server-url=http://localhost:8180/auth
        //keycloak.realm=canoo
        //keycloak.public-client=true
        //keycloak.resource=product-app

        AdapterConfig adapterConfig = new AdapterConfig();
        adapterConfig.setRealm(configuration.getRealmName());
        adapterConfig.setAuthServerUrl(configuration.getAuthEndpoint());
        adapterConfig.setPublicClient(true);
        adapterConfig.setResource(configuration.getApplicationName());
        return KeycloakDeploymentBuilder.build(adapterConfig);
    }

    public static void setConfiguration(KeycloakConfiguration configuration) {
        DolphinKeycloakConfigResolver.configuration = configuration;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy