X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=security%2Fruntime%2Forg.argeo.security.ldap%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fldap%2Fjcr%2FJcrUserDetailsContextMapper.java;fp=security%2Fruntime%2Forg.argeo.security.ldap%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fldap%2Fjcr%2FJcrUserDetailsContextMapper.java;h=bfbed855860f4f37f57d1444600a6f7c2a3559fa;hb=2745f0c8c57d9468855179d56f858fb2448f779c;hp=0e8dbab32abff9c117bf466460c9f88126f7579d;hpb=113e31e7c85bfad76d3c2ce6c20d63557a6fc02a;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/jcr/JcrUserDetailsContextMapper.java b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/jcr/JcrUserDetailsContextMapper.java index 0e8dbab32..bfbed8558 100644 --- a/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/jcr/JcrUserDetailsContextMapper.java +++ b/security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/jcr/JcrUserDetailsContextMapper.java @@ -9,16 +9,13 @@ import java.util.Random; import java.util.concurrent.Executor; import javax.jcr.Node; -import javax.jcr.Repository; import javax.jcr.RepositoryException; -import javax.jcr.RepositoryFactory; import javax.jcr.Session; import javax.jcr.nodetype.NodeType; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.ArgeoException; -import org.argeo.jcr.ArgeoJcrConstants; import org.argeo.jcr.ArgeoNames; import org.argeo.jcr.ArgeoTypes; import org.argeo.jcr.JcrUtils; @@ -76,10 +73,15 @@ public class JcrUserDetailsContextMapper implements UserDetailsContextMapper, userHomePathT.append(userHomepath); } }; - if (SecurityContextHolder.getContext().getAuthentication() == null)// authentication + + if (SecurityContextHolder.getContext().getAuthentication() == null) { + // authentication systemExecutor.execute(action); - else + JcrUtils.logoutQuietly(session); + } else { + // authenticated user action.run(); + } // password byte[] arr = (byte[]) ctx @@ -157,7 +159,7 @@ public class JcrUserDetailsContextMapper implements UserDetailsContextMapper, final JcrUserDetails jcrUserDetails = (JcrUserDetails) user; // systemExecutor.execute(new Runnable() { // public void run() { -// Session session = null; + // Session session = null; try { // Repository nodeRepo = JcrUtils.getRepositoryByAlias( // repositoryFactory, ArgeoJcrConstants.ALIAS_NODE);