changes to support single-sign-on (sso)
parent
ab04189b93
commit
80acc01418
34
pom.xml
34
pom.xml
|
@ -32,9 +32,7 @@
|
||||||
<target-java.version>${source-java.version}</target-java.version>
|
<target-java.version>${source-java.version}</target-java.version>
|
||||||
|
|
||||||
<!-- For local development properties begins.. -->
|
<!-- For local development properties begins.. -->
|
||||||
<!--<tomcat-catalina.version>apache-tomcat-8.5.32</tomcat-catalina.version>-->
|
<tomcat.version>8.5.32</tomcat.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>-->
|
|
||||||
<!-- For local development properties end.. -->
|
<!-- For local development properties end.. -->
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
@ -56,21 +54,21 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- For local development dependency begins.. -->
|
<!-- For local development dependency begins.. -->
|
||||||
<!--<dependency>-->
|
<dependency>
|
||||||
<!--<groupId>apache-tomcat</groupId>-->
|
<groupId>org.apache.tomcat</groupId>
|
||||||
<!--<artifactId>catalina</artifactId>-->
|
<artifactId>tomcat-catalina</artifactId>
|
||||||
<!--<version>${tomcat-catalina.version}</version>-->
|
<version>${tomcat.version}</version>
|
||||||
<!--</dependency>-->
|
</dependency>
|
||||||
<!--<dependency>-->
|
<dependency>
|
||||||
<!--<groupId>apache-tomcat</groupId>-->
|
<groupId>org.apache.tomcat</groupId>
|
||||||
<!--<artifactId>servlet-api</artifactId>-->
|
<artifactId>tomcat-servlet-api</artifactId>
|
||||||
<!--<version>${tomcat-servlet-api.version}</version>-->
|
<version>${tomcat.version}</version>
|
||||||
<!--</dependency>-->
|
</dependency>
|
||||||
<!--<dependency>-->
|
<dependency>
|
||||||
<!--<groupId>apache-tomcat</groupId>-->
|
<groupId>org.apache.tomcat</groupId>
|
||||||
<!--<artifactId>tomcat-api</artifactId>-->
|
<artifactId>tomcat-api</artifactId>
|
||||||
<!--<version>${tomcat-api.version}</version>-->
|
<version>${tomcat.version}</version>
|
||||||
<!--</dependency>-->
|
</dependency>
|
||||||
<!-- For local development dependency end.. -->
|
<!-- For local development dependency end.. -->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@ package tomcat.request.session.redis;
|
||||||
|
|
||||||
import org.apache.catalina.Container;
|
import org.apache.catalina.Container;
|
||||||
import org.apache.catalina.Context;
|
import org.apache.catalina.Context;
|
||||||
import org.apache.catalina.LifecycleException;
|
import org.apache.catalina.Manager;
|
||||||
import org.apache.catalina.LifecycleState;
|
|
||||||
import org.apache.catalina.Realm;
|
import org.apache.catalina.Realm;
|
||||||
import org.apache.catalina.Session;
|
import org.apache.catalina.Session;
|
||||||
import org.apache.catalina.authenticator.Constants;
|
import org.apache.catalina.authenticator.Constants;
|
||||||
|
@ -30,25 +29,13 @@ public class SingleSignOnValve extends SingleSignOn {
|
||||||
private Context context;
|
private Context context;
|
||||||
private SessionManager manager;
|
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} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public void invoke(Request request, Response response) throws BackendException {
|
public void invoke(Request request, Response response) throws BackendException {
|
||||||
try {
|
try {
|
||||||
|
this.setContext(request.getContext());
|
||||||
|
this.setSessionManager(request.getContext().getManager());
|
||||||
|
|
||||||
request.removeNote("org.apache.catalina.request.SSOID");
|
request.removeNote("org.apache.catalina.request.SSOID");
|
||||||
LOGGER.debug("singleSignOn.debug.invoke, requestURI: {}", request.getRequestURI());
|
LOGGER.debug("singleSignOn.debug.invoke, requestURI: {}", request.getRequestURI());
|
||||||
|
|
||||||
|
@ -103,8 +90,6 @@ public class SingleSignOnValve extends SingleSignOn {
|
||||||
} catch (IOException | ServletException | RuntimeException ex) {
|
} catch (IOException | ServletException | RuntimeException ex) {
|
||||||
LOGGER.error("Error processing request", ex);
|
LOGGER.error("Error processing request", ex);
|
||||||
throw new BackendException();
|
throw new BackendException();
|
||||||
} finally {
|
|
||||||
this.manager.afterRequest();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,8 +209,8 @@ public class SingleSignOnValve extends SingleSignOn {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** To set session manager. */
|
/** To set session manager. */
|
||||||
void setSessionManager(SessionManager manager) {
|
void setSessionManager(Manager manager) {
|
||||||
this.manager = manager;
|
this.manager = (SessionManager) manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** To set context. */
|
/** To set context. */
|
||||||
|
|
Loading…
Reference in New Issue