mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
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:
parent
c5edda8e9f
commit
126421fb15
@ -118,6 +118,7 @@ public class AuthenticationServiceImpl implements AuthenticationService
|
|||||||
clearCurrentSecurityContext();
|
clearCurrentSecurityContext();
|
||||||
throw ae;
|
throw ae;
|
||||||
}
|
}
|
||||||
|
ticketComponent.clearCurrentTicket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean authenticationExists(String userName)
|
public boolean authenticationExists(String userName)
|
||||||
@ -168,6 +169,7 @@ public class AuthenticationServiceImpl implements AuthenticationService
|
|||||||
public void clearCurrentSecurityContext()
|
public void clearCurrentSecurityContext()
|
||||||
{
|
{
|
||||||
authenticationComponent.clearCurrentSecurityContext();
|
authenticationComponent.clearCurrentSecurityContext();
|
||||||
|
ticketComponent.clearCurrentTicket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCurrentUserTheSystemUser()
|
public boolean isCurrentUserTheSystemUser()
|
||||||
@ -183,6 +185,7 @@ public class AuthenticationServiceImpl implements AuthenticationService
|
|||||||
public void authenticateAsGuest() throws AuthenticationException
|
public void authenticateAsGuest() throws AuthenticationException
|
||||||
{
|
{
|
||||||
authenticationComponent.setGuestUserAsCurrentUser();
|
authenticationComponent.setGuestUserAsCurrentUser();
|
||||||
|
ticketComponent.clearCurrentTicket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean guestUserAuthenticationAllowed()
|
public boolean guestUserAuthenticationAllowed()
|
||||||
|
@ -465,6 +465,8 @@ public class AuthenticationTest extends TestCase
|
|||||||
// assertNull(dao.getUserOrNull("Andy"));
|
// assertNull(dao.getUserOrNull("Andy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void testTicket()
|
public void testTicket()
|
||||||
{
|
{
|
||||||
dao.createUser("Andy", "ticket".toCharArray());
|
dao.createUser("Andy", "ticket".toCharArray());
|
||||||
@ -703,6 +705,32 @@ public class AuthenticationTest extends TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
public void testAuthenticationService1()
|
||||||
{
|
{
|
||||||
authenticationService.createAuthentication("GUEST", "".toCharArray());
|
authenticationService.createAuthentication("GUEST", "".toCharArray());
|
||||||
|
@ -277,6 +277,7 @@ public abstract class AuthenticationUtil
|
|||||||
public static void clearCurrentSecurityContext()
|
public static void clearCurrentSecurityContext()
|
||||||
{
|
{
|
||||||
ContextHolder.setContext(null);
|
ContextHolder.setContext(null);
|
||||||
|
InMemoryTicketComponentImpl.clearCurrentSecurityContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -340,4 +340,13 @@ public class InMemoryTicketComponentImpl implements TicketComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearCurrentTicket()
|
||||||
|
{
|
||||||
|
clearCurrentSecurityContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearCurrentSecurityContext()
|
||||||
|
{
|
||||||
|
currentTicket.set(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,4 +97,10 @@ public interface TicketComponent
|
|||||||
* @return the authority
|
* @return the authority
|
||||||
*/
|
*/
|
||||||
public String getAuthorityForTicket(String ticket);
|
public String getAuthorityForTicket(String ticket);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the current ticket
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void clearCurrentTicket();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user