diff --git a/pom.xml b/pom.xml index 20c7074..d02dc2b 100644 --- a/pom.xml +++ b/pom.xml @@ -32,9 +32,7 @@ ${source-java.version} - - - + 8.5.32 @@ -56,21 +54,21 @@ - - - - - - - - - - - - - - - + + org.apache.tomcat + tomcat-catalina + ${tomcat.version} + + + org.apache.tomcat + tomcat-servlet-api + ${tomcat.version} + + + org.apache.tomcat + tomcat-api + ${tomcat.version} + diff --git a/src/main/java/tomcat/request/session/redis/SingleSignOnValve.java b/src/main/java/tomcat/request/session/redis/SingleSignOnValve.java index b57207f..a6fa489 100644 --- a/src/main/java/tomcat/request/session/redis/SingleSignOnValve.java +++ b/src/main/java/tomcat/request/session/redis/SingleSignOnValve.java @@ -2,8 +2,7 @@ package tomcat.request.session.redis; import org.apache.catalina.Container; import org.apache.catalina.Context; -import org.apache.catalina.LifecycleException; -import org.apache.catalina.LifecycleState; +import org.apache.catalina.Manager; import org.apache.catalina.Realm; import org.apache.catalina.Session; import org.apache.catalina.authenticator.Constants; @@ -30,25 +29,13 @@ public class SingleSignOnValve extends SingleSignOn { private Context context; private SessionManager manager; - /** {@inheritDoc} */ - @Override - protected synchronized void startInternal() throws LifecycleException { - super.setState(LifecycleState.STARTING); - super.startInternal(); - } - - /** {@inheritDoc} */ - @Override - protected synchronized void stopInternal() throws LifecycleException { - super.setState(LifecycleState.STOPPING); - super.stopInternal(); - this.context = null; - } - /** {@inheritDoc} */ @Override public void invoke(Request request, Response response) throws BackendException { try { + this.setContext(request.getContext()); + this.setSessionManager(request.getContext().getManager()); + request.removeNote("org.apache.catalina.request.SSOID"); LOGGER.debug("singleSignOn.debug.invoke, requestURI: {}", request.getRequestURI()); @@ -103,8 +90,6 @@ public class SingleSignOnValve extends SingleSignOn { } catch (IOException | ServletException | RuntimeException ex) { LOGGER.error("Error processing request", ex); throw new BackendException(); - } finally { - this.manager.afterRequest(); } } @@ -224,8 +209,8 @@ public class SingleSignOnValve extends SingleSignOn { } /** To set session manager. */ - void setSessionManager(SessionManager manager) { - this.manager = manager; + void setSessionManager(Manager manager) { + this.manager = (SessionManager) manager; } /** To set context. */