import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.api.NodeConstants;
import org.argeo.api.cms.CmsApp;
+import org.argeo.api.cms.CmsAuth;
import org.argeo.api.cms.CmsImageManager;
+import org.argeo.api.cms.CmsLog;
import org.argeo.api.cms.CmsSession;
import org.argeo.api.cms.CmsUi;
import org.argeo.api.cms.CmsView;
import org.argeo.cms.LocaleUtils;
import org.argeo.cms.auth.CurrentUser;
import org.argeo.cms.auth.RemoteAuthCallbackHandler;
-import org.argeo.cms.osgi.CmsOsgiUtils;
import org.argeo.cms.servlet.ServletHttpRequest;
import org.argeo.cms.servlet.ServletHttpResponse;
import org.argeo.cms.swt.CmsSwtUtils;
@SuppressWarnings("restriction")
public class CmsWebEntryPoint implements EntryPoint, CmsView, BrowserNavigationListener {
private static final long serialVersionUID = 7733510691684570402L;
- private final static Log log = LogFactory.getLog(CmsWebEntryPoint.class);
+ private final static CmsLog log = CmsLog.getLog(CmsWebEntryPoint.class);
private EventAdmin eventAdmin;
// Initial login
LoginContext lc;
try {
- lc = new LoginContext(NodeConstants.LOGIN_CONTEXT_USER,
+ lc = new LoginContext(CmsAuth.LOGIN_CONTEXT_USER,
new RemoteAuthCallbackHandler(new ServletHttpRequest(UiContext.getHttpRequest()),
new ServletHttpResponse(UiContext.getHttpResponse())));
lc.login();
} catch (LoginException e) {
try {
- lc = new LoginContext(NodeConstants.LOGIN_CONTEXT_ANONYMOUS);
+ lc = new LoginContext(CmsAuth.LOGIN_CONTEXT_ANONYMOUS);
lc.login();
} catch (LoginException e1) {
throw new IllegalStateException("Cannot log in as anonymous", e1);
try {
CurrentUser.logoutCmsSession(loginContext.getSubject());
loginContext.logout();
- LoginContext anonymousLc = new LoginContext(NodeConstants.LOGIN_CONTEXT_ANONYMOUS);
+ LoginContext anonymousLc = new LoginContext(CmsAuth.LOGIN_CONTEXT_ANONYMOUS);
anonymousLc.login();
authChange(anonymousLc);
} catch (LoginException e) {
display.syncExec(() -> {
// CmsFeedback.show("Unexpected exception in CMS", e);
exception = e;
-// log.error("Unexpected exception in CMS", e);
+ log.error("Unexpected exception in CMS", e);
doRefresh();
});
}
@Override
public CmsSession getCmsSession() {
- CmsSession cmsSession = CmsOsgiUtils.getCmsSession(cmsWebApp.getBundleContext(), getSubject());
+ CmsSession cmsSession = cmsWebApp.getCmsApp().getCmsContext().getCmsSession(getSubject());
return cmsSession;
}