diff --git a/integration/tomcat7/adapter/src/main/java/org/keycloak/adapters/tomcat7/AuthenticatedActionsValve.java b/integration/tomcat7/adapter/src/main/java/org/keycloak/adapters/tomcat7/AuthenticatedActionsValve.java old mode 100755 new mode 100644 index 541fc90ceb..4d7cc4a4e1 --- a/integration/tomcat7/adapter/src/main/java/org/keycloak/adapters/tomcat7/AuthenticatedActionsValve.java +++ b/integration/tomcat7/adapter/src/main/java/org/keycloak/adapters/tomcat7/AuthenticatedActionsValve.java @@ -1,57 +1,57 @@ -package org.keycloak.adapters.tomcat7; - -import java.io.IOException; -import java.util.logging.Logger; - -import javax.management.ObjectName; -import javax.servlet.ServletException; - -import org.apache.catalina.Container; -import org.apache.catalina.Valve; -import org.apache.catalina.connector.Request; -import org.apache.catalina.connector.Response; -import org.apache.catalina.valves.ValveBase; -import org.keycloak.adapters.AdapterDeploymentContext; -import org.keycloak.adapters.AuthenticatedActionsHandler; -import org.keycloak.adapters.KeycloakDeployment; - -/** - * Pre-installed actions that must be authenticated - *

- * Actions include: - *

- * CORS Origin Check and Response headers - * k_query_bearer_token: Get bearer token from server for Javascripts CORS requests - * - * @author Davide Ungari - * @version $Revision: 1 $ - */ -public class AuthenticatedActionsValve extends ValveBase { - private static final Logger log = Logger.getLogger(""+AuthenticatedActionsValve.class); - protected AdapterDeploymentContext deploymentContext; - - public AuthenticatedActionsValve(AdapterDeploymentContext deploymentContext, Valve next, Container container, ObjectName controller) { - this.deploymentContext = deploymentContext; - if (next == null) throw new RuntimeException("WTF is next null?!"); - setNext(next); - setContainer(container); - } - - - @Override - public void invoke(Request request, Response response) throws IOException, ServletException { - log.finer("AuthenticatedActionsValve.invoke" + request.getRequestURI()); - CatalinaHttpFacade facade = new CatalinaHttpFacade(request, response); - KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); - if (deployment != null && deployment.isConfigured()) { - AuthenticatedActionsHandler handler = new AuthenticatedActionsHandler(deployment, new CatalinaHttpFacade(request, response)); - if (handler.handledRequest()) { - return; - } - - } - getNext().invoke(request, response); - } - - -} +package org.keycloak.adapters.tomcat7; + +import java.io.IOException; +import java.util.logging.Logger; + +import javax.management.ObjectName; +import javax.servlet.ServletException; + +import org.apache.catalina.Container; +import org.apache.catalina.Valve; +import org.apache.catalina.connector.Request; +import org.apache.catalina.connector.Response; +import org.apache.catalina.valves.ValveBase; +import org.keycloak.adapters.AdapterDeploymentContext; +import org.keycloak.adapters.AuthenticatedActionsHandler; +import org.keycloak.adapters.KeycloakDeployment; + +/** + * Pre-installed actions that must be authenticated + *

+ * Actions include: + *

+ * CORS Origin Check and Response headers + * k_query_bearer_token: Get bearer token from server for Javascripts CORS requests + * + * @author Davide Ungari + * @version $Revision: 1 $ + */ +public class AuthenticatedActionsValve extends ValveBase { + private static final Logger log = Logger.getLogger(""+AuthenticatedActionsValve.class); + protected AdapterDeploymentContext deploymentContext; + + public AuthenticatedActionsValve(AdapterDeploymentContext deploymentContext, Valve next, Container container, ObjectName controller) { + this.deploymentContext = deploymentContext; + if (next == null) throw new RuntimeException("WTF is next null?!"); + setNext(next); + setContainer(container); + } + + + @Override + public void invoke(Request request, Response response) throws IOException, ServletException { + log.finer("AuthenticatedActionsValve.invoke" + request.getRequestURI()); + CatalinaHttpFacade facade = new CatalinaHttpFacade(request, response); + KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); + if (deployment != null && deployment.isConfigured()) { + AuthenticatedActionsHandler handler = new AuthenticatedActionsHandler(deployment, new CatalinaHttpFacade(request, response)); + if (handler.handledRequest()) { + return; + } + + } + getNext().invoke(request, response); + } + + +} \ No newline at end of file diff --git a/integration/tomcat7/adapter/src/main/java/org/keycloak/adapters/tomcat7/KeycloakAuthenticatorValve.java b/integration/tomcat7/adapter/src/main/java/org/keycloak/adapters/tomcat7/KeycloakAuthenticatorValve.java index 21e08db3d6..2c7a1c735b 100755 --- a/integration/tomcat7/adapter/src/main/java/org/keycloak/adapters/tomcat7/KeycloakAuthenticatorValve.java +++ b/integration/tomcat7/adapter/src/main/java/org/keycloak/adapters/tomcat7/KeycloakAuthenticatorValve.java @@ -50,15 +50,15 @@ public class KeycloakAuthenticatorValve extends FormAuthenticator implements Lif @Override public void lifecycleEvent(LifecycleEvent event) { - if (event.getType() == Lifecycle.START_EVENT) { + if (Lifecycle.START_EVENT.equals(event.getType())) { try { startDeployment(); } catch (LifecycleException e) { log.severe("Error starting deployment. " + e.getMessage()); } + } else if (Lifecycle.AFTER_START_EVENT.equals(event.getType())) { + initInternal(); } - - if (event.getType() == Lifecycle.AFTER_START_EVENT) initInternal(); } @Override