parent
c187c17945
commit
47a304bea2
2 changed files with 12 additions and 4 deletions
|
@ -48,11 +48,13 @@ class KeycloakHttpServerAuthenticationMechanism implements HttpServerAuthenticat
|
||||||
private final Map<String, ?> properties;
|
private final Map<String, ?> properties;
|
||||||
private final CallbackHandler callbackHandler;
|
private final CallbackHandler callbackHandler;
|
||||||
private final AdapterDeploymentContext deploymentContext;
|
private final AdapterDeploymentContext deploymentContext;
|
||||||
|
private final NodesRegistrationManagement nodesRegistrationManagement;
|
||||||
|
|
||||||
public KeycloakHttpServerAuthenticationMechanism(Map<String, ?> properties, CallbackHandler callbackHandler, AdapterDeploymentContext deploymentContext) {
|
public KeycloakHttpServerAuthenticationMechanism(Map<String, ?> properties, CallbackHandler callbackHandler, AdapterDeploymentContext deploymentContext, NodesRegistrationManagement nodesRegistrationManagement) {
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
this.deploymentContext = deploymentContext;
|
this.deploymentContext = deploymentContext;
|
||||||
|
this.nodesRegistrationManagement = nodesRegistrationManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -129,8 +131,6 @@ class KeycloakHttpServerAuthenticationMechanism implements HttpServerAuthenticat
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean preActions(ElytronHttpFacade httpFacade, AdapterDeploymentContext deploymentContext) {
|
private boolean preActions(ElytronHttpFacade httpFacade, AdapterDeploymentContext deploymentContext) {
|
||||||
NodesRegistrationManagement nodesRegistrationManagement = new NodesRegistrationManagement();
|
|
||||||
|
|
||||||
nodesRegistrationManagement.tryRegister(httpFacade.getDeployment());
|
nodesRegistrationManagement.tryRegister(httpFacade.getDeployment());
|
||||||
|
|
||||||
PreAuthActionsHandler preActions = new PreAuthActionsHandler(UserSessionManagement.class.cast(httpFacade.getTokenStore()), deploymentContext, httpFacade);
|
PreAuthActionsHandler preActions = new PreAuthActionsHandler(UserSessionManagement.class.cast(httpFacade.getTokenStore()), deploymentContext, httpFacade);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
package org.keycloak.adapters.elytron;
|
package org.keycloak.adapters.elytron;
|
||||||
|
|
||||||
import org.keycloak.adapters.AdapterDeploymentContext;
|
import org.keycloak.adapters.AdapterDeploymentContext;
|
||||||
|
import org.keycloak.adapters.NodesRegistrationManagement;
|
||||||
import org.wildfly.security.http.HttpAuthenticationException;
|
import org.wildfly.security.http.HttpAuthenticationException;
|
||||||
import org.wildfly.security.http.HttpServerAuthenticationMechanism;
|
import org.wildfly.security.http.HttpServerAuthenticationMechanism;
|
||||||
import org.wildfly.security.http.HttpServerAuthenticationMechanismFactory;
|
import org.wildfly.security.http.HttpServerAuthenticationMechanismFactory;
|
||||||
|
@ -33,6 +34,7 @@ import java.util.Map;
|
||||||
public class KeycloakHttpServerAuthenticationMechanismFactory implements HttpServerAuthenticationMechanismFactory {
|
public class KeycloakHttpServerAuthenticationMechanismFactory implements HttpServerAuthenticationMechanismFactory {
|
||||||
|
|
||||||
private final AdapterDeploymentContext deploymentContext;
|
private final AdapterDeploymentContext deploymentContext;
|
||||||
|
private final NodesRegistrationManagement nodesRegistrationManagement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Creates a new instance.
|
* <p>Creates a new instance.
|
||||||
|
@ -45,6 +47,7 @@ public class KeycloakHttpServerAuthenticationMechanismFactory implements HttpSer
|
||||||
|
|
||||||
public KeycloakHttpServerAuthenticationMechanismFactory(AdapterDeploymentContext deploymentContext) {
|
public KeycloakHttpServerAuthenticationMechanismFactory(AdapterDeploymentContext deploymentContext) {
|
||||||
this.deploymentContext = deploymentContext;
|
this.deploymentContext = deploymentContext;
|
||||||
|
this.nodesRegistrationManagement = new NodesRegistrationManagement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,9 +62,14 @@ public class KeycloakHttpServerAuthenticationMechanismFactory implements HttpSer
|
||||||
mechanismProperties.putAll(properties);
|
mechanismProperties.putAll(properties);
|
||||||
|
|
||||||
if (KeycloakHttpServerAuthenticationMechanism.NAME.equals(mechanismName)) {
|
if (KeycloakHttpServerAuthenticationMechanism.NAME.equals(mechanismName)) {
|
||||||
return new KeycloakHttpServerAuthenticationMechanism(properties, callbackHandler, this.deploymentContext);
|
return new KeycloakHttpServerAuthenticationMechanism(properties, callbackHandler, this.deploymentContext, nodesRegistrationManagement);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shutdown() {
|
||||||
|
this.nodesRegistrationManagement.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue