changes to support single-sign-on (sso)

master
Ranjith Manickam 2020-04-02 12:44:40 +05:30
parent ab04189b93
commit 80acc01418
2 changed files with 22 additions and 39 deletions

34
pom.xml
View File

@ -32,9 +32,7 @@
<target-java.version>${source-java.version}</target-java.version>
<!-- For local development properties begins.. -->
<!--<tomcat-catalina.version>apache-tomcat-8.5.32</tomcat-catalina.version>-->
<!--<tomcat-servlet-api.version>apache-tomcat-8.5.32</tomcat-servlet-api.version>-->
<!--<tomcat-api.version>apache-tomcat-8.5.32</tomcat-api.version>-->
<tomcat.version>8.5.32</tomcat.version>
<!-- For local development properties end.. -->
</properties>
@ -56,21 +54,21 @@
</dependency>
<!-- For local development dependency begins.. -->
<!--<dependency>-->
<!--<groupId>apache-tomcat</groupId>-->
<!--<artifactId>catalina</artifactId>-->
<!--<version>${tomcat-catalina.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>apache-tomcat</groupId>-->
<!--<artifactId>servlet-api</artifactId>-->
<!--<version>${tomcat-servlet-api.version}</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>apache-tomcat</groupId>-->
<!--<artifactId>tomcat-api</artifactId>-->
<!--<version>${tomcat-api.version}</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-api</artifactId>
<version>${tomcat.version}</version>
</dependency>
<!-- For local development dependency end.. -->
</dependencies>

View File

@ -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. */