Merged V2.2. to HEAD

7236: Merged V2.1 to V2.2
      7205: Typos and fixed Italian messages
      7234: Fix AR-1824 (Login ticket stuff)
      7235: Fix for AWC-1513 and AWC-1139


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7237 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley 2007-10-26 13:21:16 +00:00
parent c5edda8e9f
commit 126421fb15
5 changed files with 47 additions and 0 deletions

View File

@ -118,6 +118,7 @@ public class AuthenticationServiceImpl implements AuthenticationService
clearCurrentSecurityContext();
throw ae;
}
ticketComponent.clearCurrentTicket();
}
public boolean authenticationExists(String userName)
@ -168,6 +169,7 @@ public class AuthenticationServiceImpl implements AuthenticationService
public void clearCurrentSecurityContext()
{
authenticationComponent.clearCurrentSecurityContext();
ticketComponent.clearCurrentTicket();
}
public boolean isCurrentUserTheSystemUser()
@ -183,6 +185,7 @@ public class AuthenticationServiceImpl implements AuthenticationService
public void authenticateAsGuest() throws AuthenticationException
{
authenticationComponent.setGuestUserAsCurrentUser();
ticketComponent.clearCurrentTicket();
}
public boolean guestUserAuthenticationAllowed()

View File

@ -465,6 +465,8 @@ public class AuthenticationTest extends TestCase
// assertNull(dao.getUserOrNull("Andy"));
}
public void testTicket()
{
dao.createUser("Andy", "ticket".toCharArray());
@ -702,6 +704,32 @@ public class AuthenticationTest extends TestCase
// assertNull(dao.getUserOrNull("Andy"));
}
public void testAuthenticationServiceGetNewTicket()
{
authenticationService.createAuthentication("GUEST", "".toCharArray());
authenticationService.authenticate("GUEST", "".toCharArray());
// create an authentication object e.g. the user
authenticationService.createAuthentication("Andy", "auth1".toCharArray());
// authenticate with this user details
authenticationService.authenticate("Andy", "auth1".toCharArray());
// assert the user is authenticated
assertEquals("Andy", authenticationService.getCurrentUserName());
String ticket1 = authenticationService.getCurrentTicket();
authenticationService.authenticate("Andy", "auth1".toCharArray());
// assert the user is authenticated
assertEquals("Andy", authenticationService.getCurrentUserName());
String ticket2 = authenticationService.getCurrentTicket();
assertFalse(ticket1.equals(ticket2));
}
public void testAuthenticationService1()
{

View File

@ -277,6 +277,7 @@ public abstract class AuthenticationUtil
public static void clearCurrentSecurityContext()
{
ContextHolder.setContext(null);
InMemoryTicketComponentImpl.clearCurrentSecurityContext();
}
/**

View File

@ -340,4 +340,13 @@ public class InMemoryTicketComponentImpl implements TicketComponent
}
}
public void clearCurrentTicket()
{
clearCurrentSecurityContext();
}
public static void clearCurrentSecurityContext()
{
currentTicket.set(null);
}
}

View File

@ -97,4 +97,10 @@ public interface TicketComponent
* @return the authority
*/
public String getAuthorityForTicket(String ticket);
/**
* Clear the current ticket
*
*/
public void clearCurrentTicket();
}