--- /dev/null
+package com.liferay.portal.servlet.filters.sso;
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
+import com.liferay.portal.kernel.servlet.BaseFilter;
+import com.liferay.portal.util.PortalUtil;
+import com.pentila.entSavoie.utils.ENTMainUtilsLocalServiceUtil;
+
+public class ShibbolethFilter extends BaseFilter {
+
+ @Override
+ protected Log getLog() {
+ return _log;
+ }
+
+ @Override
+ protected void processFilter(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException,
+ ServletException {
+ try {
+ long companyId = PortalUtil.getCompanyId(request);
+
+ if (ENTMainUtilsLocalServiceUtil.isShibbolethAuthEnable(companyId)) {
+ String pathInfo = request.getPathInfo();
+
+ if (pathInfo.indexOf("/portal/logout") != -1) {
+ HttpSession session = request.getSession();
+ session.invalidate();
+ String logoutUrl = ENTMainUtilsLocalServiceUtil.getShibbolethLogoutUrl(companyId);
+ response.sendRedirect(logoutUrl);
+ }
+ else {
+ // on fait rien, on est pas sur le logout....
+ }
+ }
+ else {
+ processFilter(ShibbolethFilter.class, request, response, filterChain);
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ private static Log _log = LogFactoryUtil.getLog(ShibbolethFilter.class);
+
+}