Fix issue with session authentication in web.
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 8 Oct 2015 10:05:54 +0000 (10:05 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 8 Oct 2015 10:05:54 +0000 (10:05 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@8464 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.cms/src/org/argeo/cms/AbstractCmsEntryPoint.java

index 446e076802e66bc06c7515f99e25116787d06ac7..a9ad03a12470055dfac85116237bf5f825235dcc 100644 (file)
@@ -74,24 +74,25 @@ public abstract class AbstractCmsEntryPoint extends AbstractEntryPoint
                                .getAttribute(KernelHeader.ACCESS_CONTROL_CONTEXT);
                if (acc != null
                                && Subject.getSubject(acc).getPrincipals(X500Principal.class)
-                                               .size() == 1)
+                                               .size() == 1) {
                        subject = Subject.getSubject(acc);
-               else
+               } else {
                        subject = new Subject();
 
-               // Initial login
-               try {
-                       new ArgeoLoginContext(KernelHeader.LOGIN_CONTEXT_USER, subject)
-                                       .login();
-               } catch (LoginException e) {
-                       // if (log.isTraceEnabled())
-                       // log.trace("Cannot authenticate user", e);
+                       // Initial login
                        try {
-                               new ArgeoLoginContext(KernelHeader.LOGIN_CONTEXT_ANONYMOUS,
-                                               subject).login();
-                       } catch (LoginException eAnonymous) {
-                               throw new ArgeoException("Cannot initialize subject",
-                                               eAnonymous);
+                               new ArgeoLoginContext(KernelHeader.LOGIN_CONTEXT_USER, subject)
+                                               .login();
+                       } catch (LoginException e) {
+                               // if (log.isTraceEnabled())
+                               // log.trace("Cannot authenticate user", e);
+                               try {
+                                       new ArgeoLoginContext(KernelHeader.LOGIN_CONTEXT_ANONYMOUS,
+                                                       subject).login();
+                               } catch (LoginException eAnonymous) {
+                                       throw new ArgeoException("Cannot initialize subject",
+                                                       eAnonymous);
+                               }
                        }
                }
                authChange();
@@ -237,17 +238,17 @@ public abstract class AbstractCmsEntryPoint extends AbstractEntryPoint
                });
        }
 
-//     @Override
-//     public Object local(Msg msg) {
-//             String key = msg.getId();
-//             int lastDot = key.lastIndexOf('.');
-//             String className = key.substring(0, lastDot);
-//             String fieldName = key.substring(lastDot + 1);
-//             Locale locale = RWT.getLocale();
-//             ResourceBundle rb = ResourceBundle.getBundle(className, locale,
-//                             msg.getClassLoader());
-//             return rb.getString(fieldName);
-//     }
+       // @Override
+       // public Object local(Msg msg) {
+       // String key = msg.getId();
+       // int lastDot = key.lastIndexOf('.');
+       // String className = key.substring(0, lastDot);
+       // String fieldName = key.substring(lastDot + 1);
+       // Locale locale = RWT.getLocale();
+       // ResourceBundle rb = ResourceBundle.getBundle(className, locale,
+       // msg.getClassLoader());
+       // return rb.getString(fieldName);
+       // }
 
        /** Sets the state of the entry point and retrieve the related JCR node. */
        protected synchronized String setState(String newState) {