Ask for password
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / spring / AbstractSystemExecution.java
index a7297ef367979a94d36c10f5278feacd9189f624..ce92c4613ca97499a261ea3c939ee7aad8601a20 100644 (file)
@@ -22,23 +22,19 @@ import javax.security.auth.login.LoginException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.cms.CmsException;
+import org.argeo.node.NodeConstants;
 
 /** Provides base method for executing code with system authorization. */
 abstract class AbstractSystemExecution {
        private final static Log log = LogFactory.getLog(AbstractSystemExecution.class);
        private final Subject subject = new Subject();
 
-       private final String loginModule = "SYSTEM";
-
-       /**
-        * Authenticate the calling thread to the underlying
-        * {@link AuthenticationManager}
-        */
+       /** Authenticate the calling thread */
        protected void authenticateAsSystem() {
                ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
                try {
-                       LoginContext lc = new LoginContext(loginModule, subject);
+                       LoginContext lc = new LoginContext(NodeConstants.LOGIN_CONTEXT_DATA_ADMIN, subject);
                        lc.login();
                } catch (LoginException e) {
                        throw new CmsException("Cannot login as system", e);
@@ -53,7 +49,7 @@ abstract class AbstractSystemExecution {
                ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
                try {
-                       LoginContext lc = new LoginContext(loginModule, subject);
+                       LoginContext lc = new LoginContext(NodeConstants.LOGIN_CONTEXT_DATA_ADMIN, subject);
                        lc.logout();
                } catch (LoginException e) {
                        throw new CmsException("Cannot logout as system", e);