Massive Argeo APIs refactoring
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / auth / CmsSessionImpl.java
index 734b874efff24743c9dc998f5c6aab0db9d67f16..b0824e84bb1924835d0232c1691a7609d8de1807 100644 (file)
@@ -21,11 +21,10 @@ import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
 import javax.security.auth.x500.X500Principal;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.api.NodeConstants;
-import org.argeo.api.security.NodeSecurityUtils;
-import org.argeo.cms.auth.CmsSession;
+import org.argeo.api.cms.CmsSession;
+import org.argeo.api.cms.CmsLog;
+import org.argeo.cms.security.NodeSecurityUtils;
+import org.argeo.api.cms.CmsAuth;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
@@ -37,7 +36,7 @@ import org.osgi.service.useradmin.Authorization;
 public class CmsSessionImpl implements CmsSession, Serializable {
        private static final long serialVersionUID = 1867719354246307225L;
        private final static BundleContext bc = FrameworkUtil.getBundle(CmsSessionImpl.class).getBundleContext();
-       private final static Log log = LogFactory.getLog(CmsSessionImpl.class);
+       private final static CmsLog log = CmsLog.getLog(CmsSessionImpl.class);
 
        // private final Subject initialSubject;
        private transient AccessControlContext accessControlContext;
@@ -93,13 +92,12 @@ public class CmsSessionImpl implements CmsSession, Serializable {
                end = ZonedDateTime.now();
                serviceRegistration.unregister();
 
-
                try {
                        LoginContext lc;
                        if (isAnonymous()) {
-                               lc = new LoginContext(NodeConstants.LOGIN_CONTEXT_ANONYMOUS, getSubject());
+                               lc = new LoginContext(CmsAuth.LOGIN_CONTEXT_ANONYMOUS, getSubject());
                        } else {
-                               lc = new LoginContext(NodeConstants.LOGIN_CONTEXT_USER, getSubject());
+                               lc = new LoginContext(CmsAuth.LOGIN_CONTEXT_USER, getSubject());
                        }
                        lc.logout();
                } catch (LoginException e) {
@@ -133,12 +131,16 @@ public class CmsSessionImpl implements CmsSession, Serializable {
                return getEnd() != null;
        }
 
-       @Override
        public Authorization getAuthorization() {
                checkValid();
                return authorization;
        }
 
+       @Override
+       public String getDisplayName() {
+               return authorization.toString();
+       }
+
        @Override
        public UUID getUuid() {
                return uuid;