1 package org.jahia.params.valves; 2 3 import org.jahia.exceptions.JahiaSessionExpirationException; 4 import org.jahia.params.ParamBean; 5 import org.jahia.pipelines.PipelineException; 6 import org.jahia.pipelines.valves.Valve; 7 import org.jahia.pipelines.valves.ValveContext; 8 import org.jahia.services.usermanager.JahiaUser; 9 10 18 19 public class SessionAuthValveImpl implements Valve { 20 public SessionAuthValveImpl() { 21 } 22 23 public void invoke(Object context, ValveContext valveContext) throws PipelineException { 24 ParamBean paramBean = (ParamBean) context; 25 JahiaUser jahiaUser = null; 26 try { 30 if (!"login".equals(paramBean.getEngine())) { 31 jahiaUser = (JahiaUser) paramBean.getSession().getAttribute(ParamBean.SESSION_USER); 32 } 33 } catch (JahiaSessionExpirationException jsee) { 34 jahiaUser = null; 35 } 36 37 if (jahiaUser == null) { 38 valveContext.invokeNext(context); 39 } else { 40 paramBean.setTheUser(jahiaUser); 41 } 42 } 43 44 public void initialize() { 45 } 46 47 } 48 | Popular Tags |