X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Fauth%2FCmsAuthUtils.java;h=33a9d7ae429bb365c9cd316493783aed3f9ca196;hb=4185ff8826f893a4a1f054f61a11b89333c3e85d;hp=4c09650d4b0546bdc5c6220a23f23de99903cf95;hpb=043d226a5504a212eb5673c3ed4441c1167724d7;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/auth/CmsAuthUtils.java b/org.argeo.cms/src/org/argeo/cms/auth/CmsAuthUtils.java index 4c09650d4..33a9d7ae4 100644 --- a/org.argeo.cms/src/org/argeo/cms/auth/CmsAuthUtils.java +++ b/org.argeo.cms/src/org/argeo/cms/auth/CmsAuthUtils.java @@ -10,10 +10,10 @@ import javax.naming.InvalidNameException; import javax.naming.ldap.LdapName; import javax.security.auth.Subject; import javax.security.auth.x500.X500Principal; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; import org.argeo.api.NodeConstants; +import org.argeo.api.cms.CmsSession; +import org.argeo.api.cms.CmsSessionId; import org.argeo.api.security.AnonymousPrincipal; import org.argeo.api.security.DataAdminPrincipal; import org.argeo.api.security.NodeSecurityUtils; @@ -122,12 +122,12 @@ class CmsAuthUtils { } @SuppressWarnings("unused") - synchronized static void registerSessionAuthorization(HttpServletRequest request, Subject subject, + synchronized static void registerSessionAuthorization(RemoteAuthRequest request, Subject subject, Authorization authorization, Locale locale) { // synchronized in order to avoid multiple registrations // TODO move it to a service in order to avoid static synchronization if (request != null) { - HttpSession httpSession = request.getSession(false); + RemoteAuthSession httpSession = request.getSession(); assert httpSession != null; String httpSessId = httpSession.getId(); boolean anonymous = authorization.getName() == null; @@ -186,7 +186,7 @@ class CmsAuthUtils { } } - public static CmsSession cmsSessionFromHttpSession(BundleContext bc, String httpSessionId) { + public static CmsSessionImpl cmsSessionFromHttpSession(BundleContext bc, String httpSessionId) { Authorization authorization = null; Collection> sr; try { @@ -195,9 +195,9 @@ class CmsAuthUtils { } catch (InvalidSyntaxException e) { throw new IllegalArgumentException("Cannot get CMS session for id " + httpSessionId, e); } - CmsSession cmsSession; + CmsSessionImpl cmsSession; if (sr.size() == 1) { - cmsSession = bc.getService(sr.iterator().next()); + cmsSession = (CmsSessionImpl) bc.getService(sr.iterator().next()); // locale = cmsSession.getLocale(); authorization = cmsSession.getAuthorization(); if (authorization.getName() == null)