X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Finternal%2Fhttp%2FWebCmsSessionImpl.java;h=fd51c597a4795308a6ef9591fd65cdea0a90de9c;hb=4185ff8826f893a4a1f054f61a11b89333c3e85d;hp=3d5e3fe4c612d65781e5fe8196078dc4c05cafcb;hpb=b45e59192a4bb34a6b38a9bfa416b3dc3f6b7892;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/internal/http/WebCmsSessionImpl.java b/org.argeo.cms/src/org/argeo/cms/internal/http/WebCmsSessionImpl.java index 3d5e3fe4c..fd51c597a 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/http/WebCmsSessionImpl.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/http/WebCmsSessionImpl.java @@ -1,37 +1,33 @@ package org.argeo.cms.internal.http; +import java.util.Locale; + import javax.security.auth.Subject; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import org.argeo.cms.auth.CmsSession; +import org.argeo.cms.auth.RemoteAuthRequest; +import org.argeo.cms.auth.RemoteAuthSession; import org.argeo.cms.internal.auth.CmsSessionImpl; import org.osgi.service.useradmin.Authorization; +/** CMS session implementation in a web context. */ public class WebCmsSessionImpl extends CmsSessionImpl { - // private final static Log log = - // LogFactory.getLog(WebCmsSessionImpl.class); - - private HttpSession httpSession; + private static final long serialVersionUID = -5178883380637048025L; + private RemoteAuthSession httpSession; - public WebCmsSessionImpl(Subject initialSubject, Authorization authorization, HttpServletRequest request) { - super(initialSubject, authorization, request.getSession(false).getId()); - httpSession = request.getSession(false); + public WebCmsSessionImpl(Subject initialSubject, Authorization authorization, Locale locale, + RemoteAuthRequest request) { + super(initialSubject, authorization, locale, request.getSession().getId()); + httpSession = request.getSession(); } @Override public boolean isValid() { if (isClosed()) return false; - try {// test http session - httpSession.getCreationTime(); - return true; - } catch (IllegalStateException ise) { - return false; - } + return httpSession.isValid(); } - public static CmsSession getCmsSession(HttpServletRequest request) { - return CmsSessionImpl.getByLocalId(request.getSession(false).getId()); + public static CmsSessionImpl getCmsSession(RemoteAuthRequest request) { + return CmsSessionImpl.getByLocalId(request.getSession().getId()); } }