org.keycloak.services.resources.KeycloakApplication Java Examples

The following examples show how to use org.keycloak.services.resources.KeycloakApplication. 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: KeycloakOnUndertow.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private DeploymentInfo createAuthServerDeploymentInfo() {
    ResteasyDeployment deployment = new ResteasyDeployment();
    deployment.setApplicationClass(KeycloakApplication.class.getName());

    // RESTEASY-2034
    deployment.setProperty(ResteasyContextParameters.RESTEASY_DISABLE_HTML_SANITIZER, true);

    DeploymentInfo di = undertow.undertowDeployment(deployment);
    di.setClassLoader(getClass().getClassLoader());
    di.setContextPath("/auth");
    di.setDeploymentName("Keycloak");
    if (configuration.getKeycloakConfigPropertyOverridesMap() != null) {
        try {
            di.addInitParameter(JsonConfigProviderFactory.SERVER_CONTEXT_CONFIG_PROPERTY_OVERRIDES,
              JsonSerialization.writeValueAsString(configuration.getKeycloakConfigPropertyOverridesMap()));
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }

    di.setDefaultServletConfig(new DefaultServletConfig(true));
    di.addWelcomePage("theme/keycloak/welcome/resources/index.html");

    FilterInfo filter = Servlets.filter("SessionFilter", TestKeycloakSessionServletFilter.class);
    di.addFilter(filter);
    di.addFilterUrlMapping("SessionFilter", "/*", DispatcherType.REQUEST);
    filter.setAsyncSupported(true);

    return di;
}
 
Example #2
Source File: TestPlatform.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public void onStartup(Runnable startupHook) {
    startupHook.run();
    KeycloakApplication keycloakApplication = Resteasy.getContextData(KeycloakApplication.class);
    ServletContext context = Resteasy.getContextData(ServletContext.class);
    context.setAttribute(KeycloakSessionFactory.class.getName(),  keycloakApplication.getSessionFactory());
}
 
Example #3
Source File: WildflyPlatform.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public void onStartup(Runnable startupHook) {
    startupHook.run();
    KeycloakApplication keycloakApplication = Resteasy.getContextData(KeycloakApplication.class);
    ServletContext context = Resteasy.getContextData(ServletContext.class);
    context.setAttribute(KeycloakSessionFactory.class.getName(),  keycloakApplication.getSessionFactory());
}
 
Example #4
Source File: ClientResource.java    From keycloak with Apache License 2.0 4 votes vote down vote up
protected KeycloakApplication getKeycloakApplication() {
    return keycloak;
}