Add support for Single Log Out

Change-Id: I3111f251e3eaaff00734a7f22d35424704aee403
diff --git a/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java b/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java
index a96ac75..b3228e6 100644
--- a/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java
+++ b/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java
@@ -169,8 +169,14 @@
       } else {
         chain.doFilter(httpRequest, httpResponse);
       }
-    } catch (final HttpAction requiresHttpAction) {
-      throw new TechnicalException("Unexpected HTTP action", requiresHttpAction);
+    } catch (final HttpAction httpAction) {
+      // In pac4j v3.4.0 SLO (Single Log Out) throws HttpAction with code 200.
+      // Detect that flow and recover by redirecting to the main gerrit page.
+      if (httpAction.getCode() != 200) {
+        throw new TechnicalException("Unexpected HTTP action", httpAction);
+      }
+
+      httpResponse.sendRedirect(httpRequest.getContextPath() + "/");
     }
   }