mirror of
https://github.com/bmlong137/alfresco-keycloak.git
synced 2025-05-12 21:24:43 +00:00
Forced route URL is optional
This commit is contained in:
parent
96d01b34fe
commit
3846f34583
@ -529,30 +529,34 @@ public class KeycloakAuthenticationFilter implements DependencyInjectedFilter, I
|
|||||||
final ExtendedAdapterConfig adapterConfiguration = keycloakAdapterConfig.buildAdapterConfiguration();
|
final ExtendedAdapterConfig adapterConfiguration = keycloakAdapterConfig.buildAdapterConfiguration();
|
||||||
this.keycloakDeployment = KeycloakDeploymentBuilder.build(adapterConfiguration);
|
this.keycloakDeployment = KeycloakDeploymentBuilder.build(adapterConfiguration);
|
||||||
|
|
||||||
// we need to recreate the HttpClient to configure the forced route URL
|
final String forcedRouteUrl = adapterConfiguration.getForcedRouteUrl();
|
||||||
this.keycloakDeployment.setClient(new Callable<HttpClient>()
|
if (forcedRouteUrl != null && !forcedRouteUrl.isBlank())
|
||||||
{
|
{
|
||||||
|
// we need to recreate the HttpClient to configure the forced route URL
|
||||||
private HttpClient client;
|
this.keycloakDeployment.setClient(new Callable<HttpClient>()
|
||||||
|
|
||||||
@Override
|
|
||||||
public HttpClient call() throws Exception
|
|
||||||
{
|
{
|
||||||
if (this.client == null)
|
|
||||||
|
private HttpClient client;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpClient call() throws Exception
|
||||||
{
|
{
|
||||||
synchronized (this)
|
if (this.client == null)
|
||||||
{
|
{
|
||||||
if (this.client == null)
|
synchronized (this)
|
||||||
{
|
{
|
||||||
this.client = new HttpClientBuilder()
|
if (this.client == null)
|
||||||
.routePlanner(KeycloakAuthenticationFilter.this.createForcedRoutePlanner(adapterConfiguration))
|
{
|
||||||
.build(adapterConfiguration);
|
this.client = new HttpClientBuilder()
|
||||||
|
.routePlanner(KeycloakAuthenticationFilter.this.createForcedRoutePlanner(adapterConfiguration))
|
||||||
|
.build(adapterConfiguration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return this.client;
|
||||||
}
|
}
|
||||||
return this.client;
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
this.deploymentContext = new AdapterDeploymentContext(this.keycloakDeployment);
|
this.deploymentContext = new AdapterDeploymentContext(this.keycloakDeployment);
|
||||||
}
|
}
|
||||||
@ -1973,7 +1977,6 @@ public class KeycloakAuthenticationFilter implements DependencyInjectedFilter, I
|
|||||||
{
|
{
|
||||||
if (authServerHost.equals(target))
|
if (authServerHost.equals(target))
|
||||||
{
|
{
|
||||||
LOGGER.trace("Rerouting to forced route");
|
|
||||||
final HttpRoute route = KeycloakAuthenticationFilter.this.createForcedRoute(adapterConfig);
|
final HttpRoute route = KeycloakAuthenticationFilter.this.createForcedRoute(adapterConfig);
|
||||||
LOGGER.trace("Rerouting to forced route: {}", route);
|
LOGGER.trace("Rerouting to forced route: {}", route);
|
||||||
return route;
|
return route;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user