X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=security%2Fruntime%2Forg.argeo.security.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fjcr%2FOsJcrAuthenticationProvider.java;h=9abac5972a7f584fc1aaca81326d49877e4c41af;hb=8b8ee149b20e2578a55e17413fa5f7399ff7ba14;hp=dc47fa3831b3afc6b6f26b177e22665f017a49b4;hpb=da55282938aaebf9fa148454dbc8add9c558501f;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/OsJcrAuthenticationProvider.java b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/OsJcrAuthenticationProvider.java index dc47fa383..9abac5972 100644 --- a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/OsJcrAuthenticationProvider.java +++ b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/OsJcrAuthenticationProvider.java @@ -32,20 +32,24 @@ public class OsJcrAuthenticationProvider extends OsAuthenticationProvider { final Repository repository = getRepositoryBlocking(); systemExecutor.execute(new Runnable() { public void run() { + Session session = null; try { - Session session = repository.login(workspace); - // WARNING: at this stage we assume that teh java properties + session = repository.login(workspace); + // WARNING: at this stage we assume that the java properties // will have the same value String userName = System.getProperty("user.name"); Node userHome = JcrUtils.getUserHome(session, userName); if (userHome == null) userHome = JcrUtils.createUserHome(session, homeBasePath, userName); - //authen.setDetails(getUserDetails(userHome, authen)); + // authen.setDetails(getUserDetails(userHome, authen)); } catch (RepositoryException e) { + JcrUtils.discardQuietly(session); throw new ArgeoException( "Unexpected exception when synchronizing OS and JCR security ", e); + } finally { + JcrUtils.logoutQuietly(session); } } });