Fix for ALF-13535 Using CMIS, on-disk tickets cache can grow unbounded

- Single ticket per user (you can have a ticket per login via configuration)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@54572 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2013-08-28 13:12:29 +00:00
parent 4e721b8636
commit 0d4d8c41d1
3 changed files with 28 additions and 5 deletions

View File

@@ -604,10 +604,13 @@
</property> </property>
<!-- If ticketsEpire is true then how they should expire --> <!-- If ticketsEpire is true then how they should expire -->
<!-- AFTER_INACTIVITY, AFTER_FIXED_TIME, DO_NOT_EXPIRE --> <!-- AFTER_INACTIVITY, AFTER_FIXED_TIME, DO_NOT_EXPIRE -->
<!-- The default is AFTER_FIXED_TIME --> <!-- The default is AFTER_INACTIVITY -->
<property name="expiryMode"> <property name="expiryMode">
<value>${authentication.ticket.expiryMode}</value> <value>${authentication.ticket.expiryMode}</value>
</property> </property>
<property name="useSingleTicketPerUser">
<value>${authentication.ticket.useSingleTicketPerUser}</value>
</property>
</bean> </bean>
</property> </property>
<property name="interceptorNames"> <property name="interceptorNames">

View File

@@ -677,6 +677,10 @@ authentication.ticket.expiryMode=AFTER_INACTIVITY
# The default is PT1H for one hour. # The default is PT1H for one hour.
authentication.ticket.validDuration=PT1H authentication.ticket.validDuration=PT1H
# Use one ticket for all user sessions
# For the pre 4.2 behaviour of one ticket per session set this to false.
authentication.ticket.useSingleTicketPerUser=true
# If kerberos.authentication.cifs.enableTicketCracking is false, # If kerberos.authentication.cifs.enableTicketCracking is false,
# the Kerberos ticket cracking code is switched off. # the Kerberos ticket cracking code is switched off.
# This code was required to get mutual authentication with a Windows AD client working in earlier versions of Java (version 5 or earlier). # This code was required to get mutual authentication with a Windows AD client working in earlier versions of Java (version 5 or earlier).

View File

@@ -338,8 +338,14 @@ public class AuthenticationTest extends TestCase
pubAuthenticationService.authenticate("Andy", "auth1".toCharArray()); pubAuthenticationService.authenticate("Andy", "auth1".toCharArray());
String ticket1 = pubAuthenticationService.getCurrentTicket(); String ticket1 = pubAuthenticationService.getCurrentTicket();
pubAuthenticationService.authenticate("Andy", "auth1".toCharArray()); pubAuthenticationService.authenticate("Andy", "auth1".toCharArray());
if(ticketComponent.getUseSingleTicketPerUser())
{
assertTrue(ticket1.equals(pubAuthenticationService.getCurrentTicket()));
}
else
{
assertFalse(ticket1.equals(pubAuthenticationService.getCurrentTicket())); assertFalse(ticket1.equals(pubAuthenticationService.getCurrentTicket()));
}
} }
public void testGuest() public void testGuest()
@@ -737,6 +743,8 @@ public class AuthenticationTest extends TestCase
public void testTicketExpiryMode() public void testTicketExpiryMode()
{ {
ticketsCache.clear();
InMemoryTicketComponentImpl tc = new InMemoryTicketComponentImpl(); InMemoryTicketComponentImpl tc = new InMemoryTicketComponentImpl();
tc.setOneOff(false); tc.setOneOff(false);
tc.setTicketsExpire(true); tc.setTicketsExpire(true);
@@ -878,6 +886,7 @@ public class AuthenticationTest extends TestCase
public void testTicketExpires() public void testTicketExpires()
{ {
ticketsCache.clear();
InMemoryTicketComponentImpl tc = new InMemoryTicketComponentImpl(); InMemoryTicketComponentImpl tc = new InMemoryTicketComponentImpl();
tc.setOneOff(false); tc.setOneOff(false);
tc.setTicketsExpire(true); tc.setTicketsExpire(true);
@@ -1036,8 +1045,15 @@ public class AuthenticationTest extends TestCase
String ticket2 = authenticationService.getCurrentTicket(); String ticket2 = authenticationService.getCurrentTicket();
if(ticketComponent.getUseSingleTicketPerUser())
{
assertTrue(ticket1.equals(ticket2));
}
else
{
assertFalse(ticket1.equals(ticket2)); assertFalse(ticket1.equals(ticket2));
} }
}
public void testAuthenticationService1() public void testAuthenticationService1()
{ {