mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-09 17:45:10 +00:00
Fix AR-730
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3317 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
623a4d8420
commit
b837029c1c
@ -645,19 +645,29 @@ public class SessionImpl implements Session
|
|||||||
if (isLive())
|
if (isLive())
|
||||||
{
|
{
|
||||||
// invalidate authentication
|
// invalidate authentication
|
||||||
getRepositoryImpl().getServiceRegistry().getAuthenticationService().invalidateTicket(getTicket());
|
|
||||||
ticket = null;
|
|
||||||
|
|
||||||
// clean up resources
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sessionIsolation.rollback();
|
try
|
||||||
|
{
|
||||||
|
getRepositoryImpl().getServiceRegistry().getAuthenticationService().invalidateTicket(getTicket());
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sessionIsolation.rollback();
|
||||||
|
}
|
||||||
|
catch(RepositoryException e)
|
||||||
|
{
|
||||||
|
// continue execution and force logout
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(RepositoryException e)
|
finally
|
||||||
{
|
{
|
||||||
// force logout
|
ticket = null;
|
||||||
|
repository.deregisterSession();
|
||||||
}
|
}
|
||||||
repository.deregisterSession();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,5 +94,29 @@ public class SessionImplTest extends BaseJCRTest
|
|||||||
assertFalse(isLive);
|
assertFalse(isLive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void testSessionThread()
|
||||||
|
{
|
||||||
|
SimpleCredentials superuser = new SimpleCredentials("superuser", "".toCharArray());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Session anotherSession = repository.login(superuser, getWorkspace());
|
||||||
|
fail("Exception not thrown when establishing two sessions on same thread");
|
||||||
|
}
|
||||||
|
catch(RepositoryException e)
|
||||||
|
{
|
||||||
|
// successful - multiple sessions on one thread caught
|
||||||
|
}
|
||||||
|
superuserSession.logout();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Session anotherSession = repository.login(superuser, getWorkspace());
|
||||||
|
anotherSession.logout();
|
||||||
|
}
|
||||||
|
catch(RepositoryException e)
|
||||||
|
{
|
||||||
|
fail("Exception thrown when it shouldn't of been.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user