mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.3-BUG-FIX to HEAD
20954: Calendar Dashlet updates. Fixes: ALF-2907 (meeting workspace issue) 20968: Minor VersionableAspect fix to onDeleteNode policy firing (follow-on for r19507) 20981: Removed Install Jammer installers from V3.3.3 20982: AVMTestSuite - run PurgeTestP after AVMServiceTest (investigating ALF-3611) 20997: Fix for ALF-2605 - updated share-config-custom.xml.sample and removed obsolete extension files 21030: Pulled XAMConnector AMP into main 3.3SP3 codeline. Apart from build changes (incl. EOL), there are no repo changes. 21032: StoreSelector passes through NodeContentContext allowing stores access to node information 21036: Fix ALF-245: Can't delete space that contains "translation without content" - Delete triggers 'unmakeTranslation' - Empty translations are marked with sys:temporary before being deleted 21051: More on fix ALF-245. Reduced complexity by not deleting empty translations twice 21064: Merged V3.3 to V3.3-BUG_FIX 20898: Merged HEAD to V3.3 20724: AVMTestSuite - temporarily comment out PurgeTestP - TODO: investigate intermittent test failure 20903: Incremented version revision 20921: AVM - fix purge store so that vr nodes are actually orphaned (ALF-3627) 20952: Fix for ALF-3704: Module conflict - Alfresco web client config property page missing metadata. This is application of a fix made to the config service in a hotfix. The change provides a deterministic load order for config files loaded via the ConfigBootstrap spring bean. More importantly it means that config files loaded by modules on different machines in a cluster load in the same order. The forms client and AWE config files have been updated to take advantage of the new loading order. 21061: Merged PATCHES/V3.1.2 to V3.3 (RECORD ONLY) 20890: ALF-3687: Apply LUCENE-1383 patch to Lucene 2.1.0 to reduce memory leaks from ThreadLocals 20891: ALF-3687: Build classpath fix 20892: Incremented version label 21062: Merged PATCHES/V3.2.1 to V3.3 20897: (RECORD ONLY) Incremented version label 20901: (RECORD ONLY) ALF-3740: Merged V3.3 to PATCHES/V3.2.1 20524: VersionMigrator - option to run as scheduled job (ALF-1000) 20904: (RECORD ONLY) ALF-3732: Merged PATCHES/V3.2.r to PATCHES/V3.2.1 19803: ALF-558: File servers (CIFS / FTP / NFS) can now handle concurrent write operations on Alfresco repository - ContentDiskDriver / AVMDiskDriver now use retrying transactions for write operations - Disable EagerContentStoreCleaner on ContentDiskDriver / AVMDiskDriver closeFile() operations so that they may be retried after rollback (Sony zero byte problem) - Allow manual association of AVM ContentData with nodes so that closeFile() may be retried - Propagation of new argument through AVM interfaces 20905: (RECORD ONLY) ALF-3732: Rolled back the now unnecessary reference()/dereference() stuff from ALF-558 20906: (RECORD ONLY) ALF-3732: Merged DEV/V3.3-BUG-FIX to PATCHES/V3.2.1 20623: Fix for ALF-3188 : Access Denied when updating doc via CIFS 20907: (RECORD ONLY) ALF-3732: Merged V3.3 to PATCHES/V3.2.1 20173: Propagate IOExceptions from retryable write transactions in AlfrescoDiskDriver 20950: ALF-3779: Upgrades on large repositories from v2.1 and v2.2 were failing on MySQL due to "The total number of locks exceeds the lock table size" errors - Solution was to add support for new --BEGIN TXN and --END TXN comments and execute LOCK TABLES statements in the same transaction as large INSERT - SELECT statements. 20990: ALF-3789: Concurrency issues with InMemoryTicketComponentImpl - Previous ETHREEOH-1842 method of caching web session 'ref counts' against tickets could cause tickets to unpredictably fall out of the transactional cache - Rolled back original ETHREEOH-1842 fix. Would be too much overhead to keep these ref counts consistent across a cluster. - Instead, avoid invalidating tickets on web session timeout and only do it on explicit log out. - Now tickets maintained in non-transactional shared cache so they can't drop out unpredictably - Logic for ticket inactivity timeout caching improved so that it should work across a cluster 20991: (RECORD ONLY) Incremented version label 20993: ALF-3789: Fixed Spring configuration backward compatibily issue with previous fix - Ticket cache bean name restored to ticketsCache. This is actually now a non-transactional cache. - Also externalized parameters so that they can now be controlled by alfresco-global.properties without any bean overrides authentication.ticket.ticketsExpire=false authentication.ticket.expiryMode=AFTER_FIXED_TIME authentication.ticket.validDuration=PT1H 20994: Eclipse classpath fixes for unit testing after ant build 21057: ALF-3592: PassthruCifsAuthenticator now auto-creates / imports users who do not already exist in Alfresco - At least one of the following properties must be true for this to happen synchronization.autoCreatePeopleOnLogin synchronization.syncWhenMissingPeopleLogIn - Also improved debug logging of unknown passthru domains 21063: Merged PATCHES/V3.2.r to V3.3 21037: ALF-3793: Final attempt at realigning saved XForm data with a modified Schema - removeRemovedNodes / insertUpdatedNodes / insertPrototypeNodes replaced by a one stop recursive process that builds a new instance tree from scratch - Nodes copied over in correct order - Missing nodes added in and extra nodes discarded - Prototype nodes appended at appropriate points 21038: (RECORD ONLY) Incremented version label git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21065 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -67,11 +67,6 @@ public abstract class AbstractAuthenticationService implements AuthenticationSer
|
||||
{
|
||||
return sysAdminParams.getMaxUsers();
|
||||
}
|
||||
|
||||
public String getCurrentTicket()
|
||||
{
|
||||
return getCurrentTicket(null);
|
||||
}
|
||||
|
||||
public abstract Set<String> getUsersWithTickets(boolean nonExpiredOnly);
|
||||
|
||||
|
@@ -32,8 +32,7 @@ import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
*
|
||||
* @author dward
|
||||
*/
|
||||
public abstract class AbstractChainingAuthenticationService extends AbstractAuthenticationService implements
|
||||
MutableAuthenticationService
|
||||
public abstract class AbstractChainingAuthenticationService extends AbstractAuthenticationService implements MutableAuthenticationService
|
||||
{
|
||||
/**
|
||||
* Instantiates a new abstract chaining authentication service.
|
||||
@@ -57,8 +56,7 @@ public abstract class AbstractChainingAuthenticationService extends AbstractAuth
|
||||
*/
|
||||
protected abstract List<AuthenticationService> getUsableAuthenticationServices();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.security.AuthenticationService#createAuthentication(java.lang.String, char[])
|
||||
*/
|
||||
public void createAuthentication(String userName, char[] password) throws AuthenticationException
|
||||
@@ -71,10 +69,8 @@ public abstract class AbstractChainingAuthenticationService extends AbstractAuth
|
||||
getMutableAuthenticationService().createAuthentication(userName, password);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.security.AuthenticationService#updateAuthentication(java.lang.String, char[],
|
||||
* char[])
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.security.AuthenticationService#updateAuthentication(java.lang.String, char[], char[])
|
||||
*/
|
||||
public void updateAuthentication(String userName, char[] oldPassword, char[] newPassword)
|
||||
throws AuthenticationException
|
||||
@@ -249,7 +245,7 @@ public abstract class AbstractChainingAuthenticationService extends AbstractAuth
|
||||
// it doesn't exist in any of the authentication components
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -293,13 +289,13 @@ public abstract class AbstractChainingAuthenticationService extends AbstractAuth
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void invalidateTicket(String ticket, String sessionId) throws AuthenticationException
|
||||
public void invalidateTicket(String ticket) throws AuthenticationException
|
||||
{
|
||||
for (AuthenticationService authService : getUsableAuthenticationServices())
|
||||
{
|
||||
try
|
||||
{
|
||||
authService.invalidateTicket(ticket, sessionId);
|
||||
authService.invalidateTicket(ticket);
|
||||
return;
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -314,13 +310,13 @@ public abstract class AbstractChainingAuthenticationService extends AbstractAuth
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void validate(String ticket, String sessionId) throws AuthenticationException
|
||||
public void validate(String ticket) throws AuthenticationException
|
||||
{
|
||||
for (AuthenticationService authService : getUsableAuthenticationServices())
|
||||
{
|
||||
try
|
||||
{
|
||||
authService.validate(ticket, sessionId);
|
||||
authService.validate(ticket);
|
||||
return;
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -335,13 +331,13 @@ public abstract class AbstractChainingAuthenticationService extends AbstractAuth
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getCurrentTicket(String sessionId)
|
||||
public String getCurrentTicket()
|
||||
{
|
||||
for (AuthenticationService authService : getUsableAuthenticationServices())
|
||||
{
|
||||
try
|
||||
{
|
||||
return authService.getCurrentTicket(sessionId);
|
||||
return authService.getCurrentTicket();
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
{
|
||||
@@ -354,13 +350,13 @@ public abstract class AbstractChainingAuthenticationService extends AbstractAuth
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getNewTicket(String sessionId)
|
||||
public String getNewTicket()
|
||||
{
|
||||
for (AuthenticationService authService : getUsableAuthenticationServices())
|
||||
{
|
||||
try
|
||||
{
|
||||
return authService.getNewTicket(sessionId);
|
||||
return authService.getNewTicket();
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
{
|
||||
@@ -552,5 +548,7 @@ public abstract class AbstractChainingAuthenticationService extends AbstractAuth
|
||||
}
|
||||
return defaultGuestUserNames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@@ -70,7 +70,7 @@ public class AuthenticationServiceImpl extends AbstractAuthenticationService imp
|
||||
throw ae;
|
||||
}
|
||||
ticketComponent.clearCurrentTicket();
|
||||
getCurrentTicket(null);
|
||||
getCurrentTicket();
|
||||
}
|
||||
|
||||
public String getCurrentUserName() throws AuthenticationException
|
||||
@@ -88,9 +88,9 @@ public class AuthenticationServiceImpl extends AbstractAuthenticationService imp
|
||||
return ticketComponent.getUsersWithTickets(nonExpiredOnly);
|
||||
}
|
||||
|
||||
public void invalidateTicket(String ticket, String sessionId) throws AuthenticationException
|
||||
public void invalidateTicket(String ticket) throws AuthenticationException
|
||||
{
|
||||
ticketComponent.invalidateTicketById(ticket, sessionId);
|
||||
ticketComponent.invalidateTicketById(ticket);
|
||||
}
|
||||
|
||||
public int countTickets(boolean nonExpiredOnly)
|
||||
@@ -104,7 +104,7 @@ public class AuthenticationServiceImpl extends AbstractAuthenticationService imp
|
||||
}
|
||||
|
||||
|
||||
public void validate(String ticket, String sessionId) throws AuthenticationException
|
||||
public void validate(String ticket) throws AuthenticationException
|
||||
{
|
||||
String currentUser = null;
|
||||
try
|
||||
@@ -112,7 +112,7 @@ public class AuthenticationServiceImpl extends AbstractAuthenticationService imp
|
||||
|
||||
// clear context - to avoid MT concurrency issue (causing domain mismatch) - see also 'authenticate' above
|
||||
clearCurrentSecurityContext();
|
||||
currentUser = ticketComponent.validateTicket(ticket, sessionId);
|
||||
currentUser = ticketComponent.validateTicket(ticket);
|
||||
authenticationComponent.setCurrentUser(currentUser, UserNameValidationMode.CHECK);
|
||||
}
|
||||
catch (AuthenticationException ae)
|
||||
@@ -122,22 +122,22 @@ public class AuthenticationServiceImpl extends AbstractAuthenticationService imp
|
||||
}
|
||||
}
|
||||
|
||||
public String getCurrentTicket(String sessionId) throws AuthenticationException
|
||||
public String getCurrentTicket() throws AuthenticationException
|
||||
{
|
||||
String userName = getCurrentUserName();
|
||||
// So that preAuthenticationCheck can constrain the creation of new tickets, we first ask for the current ticket
|
||||
// without auto-creation
|
||||
String ticket = ticketComponent.getCurrentTicket(userName, sessionId, false);
|
||||
String ticket = ticketComponent.getCurrentTicket(userName, false);
|
||||
if (ticket == null)
|
||||
{
|
||||
// If we get through the authentication check then it's safe to issue a new ticket (e.g. for
|
||||
// SSO/external-based login)
|
||||
return getNewTicket(sessionId);
|
||||
return getNewTicket();
|
||||
}
|
||||
return ticket;
|
||||
}
|
||||
|
||||
public String getNewTicket(String sessionId)
|
||||
public String getNewTicket()
|
||||
{
|
||||
String userName = getCurrentUserName();
|
||||
try
|
||||
@@ -149,7 +149,7 @@ public class AuthenticationServiceImpl extends AbstractAuthenticationService imp
|
||||
clearCurrentSecurityContext();
|
||||
throw e;
|
||||
}
|
||||
return ticketComponent.getNewTicket(userName, sessionId);
|
||||
return ticketComponent.getNewTicket(userName);
|
||||
}
|
||||
|
||||
public void clearCurrentSecurityContext()
|
||||
@@ -174,7 +174,7 @@ public class AuthenticationServiceImpl extends AbstractAuthenticationService imp
|
||||
authenticationComponent.setGuestUserAsCurrentUser();
|
||||
String guestUser = authenticationComponent.getCurrentUserName();
|
||||
ticketComponent.clearCurrentTicket();
|
||||
ticketComponent.getCurrentTicket(guestUser, null, true); // to ensure new ticket is created (even if client does not explicitly call getCurrentTicket)
|
||||
ticketComponent.getCurrentTicket(guestUser, true); // to ensure new ticket is created (even if client does not explicitly call getCurrentTicket)
|
||||
}
|
||||
|
||||
public boolean guestUserAuthenticationAllowed()
|
||||
|
@@ -278,11 +278,11 @@ public class AuthenticationTest extends TestCase
|
||||
//userTransaction = transactionService.getUserTransaction();
|
||||
//userTransaction.begin();
|
||||
|
||||
pubAuthenticationService.validate(ticket, null);
|
||||
pubAuthenticationService.validate(ticket);
|
||||
userName = pubAuthenticationService.getCurrentUserName();
|
||||
assertEquals("andy", userName);
|
||||
|
||||
pubAuthenticationService.validate(newticket, null);
|
||||
pubAuthenticationService.validate(newticket);
|
||||
userName = pubAuthenticationService.getCurrentUserName();
|
||||
assertEquals("andy", userName);
|
||||
|
||||
@@ -641,14 +641,14 @@ public class AuthenticationTest extends TestCase
|
||||
Authentication result = authenticationManager.authenticate(token);
|
||||
result.setAuthenticated(true);
|
||||
|
||||
String ticket = ticketComponent.getNewTicket(getUserName(result), null);
|
||||
String user = ticketComponent.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
String ticket = ticketComponent.getNewTicket(getUserName(result));
|
||||
String user = ticketComponent.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
|
||||
user = null;
|
||||
try
|
||||
{
|
||||
user = ticketComponent.validateTicket("INVALID", null);
|
||||
user = ticketComponent.validateTicket("INVALID");
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -656,11 +656,11 @@ public class AuthenticationTest extends TestCase
|
||||
assertNull(user);
|
||||
}
|
||||
|
||||
ticketComponent.invalidateTicketById(ticket, null);
|
||||
ticketComponent.invalidateTicketById(ticket);
|
||||
try
|
||||
{
|
||||
user = ticketComponent.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
user = ticketComponent.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -689,11 +689,11 @@ public class AuthenticationTest extends TestCase
|
||||
Authentication result = authenticationManager.authenticate(token);
|
||||
result.setAuthenticated(true);
|
||||
|
||||
String ticket = tc.getNewTicket(getUserName(result), null);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
String ticket = tc.getNewTicket(getUserName(result));
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
|
||||
dao.deleteUser("Andy");
|
||||
// assertNull(dao.getUserOrNull("Andy"));
|
||||
@@ -715,12 +715,12 @@ public class AuthenticationTest extends TestCase
|
||||
Authentication result = authenticationManager.authenticate(token);
|
||||
result.setAuthenticated(true);
|
||||
|
||||
String ticket = tc.getNewTicket(getUserName(result), null);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertTrue(!ticketComponent.getCurrentTicket("Andy", null, true).equals(ticket));
|
||||
String ticket = tc.getNewTicket(getUserName(result));
|
||||
tc.validateTicket(ticket);
|
||||
assertTrue(!ticketComponent.getCurrentTicket("Andy", true).equals(ticket));
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -749,13 +749,13 @@ public class AuthenticationTest extends TestCase
|
||||
Authentication result = authenticationManager.authenticate(token);
|
||||
result.setAuthenticated(true);
|
||||
|
||||
String ticket = tc.getNewTicket(getUserName(result), null);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
String ticket = tc.getNewTicket(getUserName(result));
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
@@ -771,7 +771,7 @@ public class AuthenticationTest extends TestCase
|
||||
}
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -781,7 +781,7 @@ public class AuthenticationTest extends TestCase
|
||||
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -791,7 +791,7 @@ public class AuthenticationTest extends TestCase
|
||||
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -814,7 +814,7 @@ public class AuthenticationTest extends TestCase
|
||||
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -823,7 +823,7 @@ public class AuthenticationTest extends TestCase
|
||||
}
|
||||
|
||||
tc.setExpiryMode(ExpiryMode.AFTER_INACTIVITY.toString());
|
||||
ticket = tc.getNewTicket(getUserName(result), null);
|
||||
ticket = tc.getNewTicket(getUserName(result));
|
||||
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
@@ -840,7 +840,7 @@ public class AuthenticationTest extends TestCase
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -860,7 +860,7 @@ public class AuthenticationTest extends TestCase
|
||||
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -889,13 +889,13 @@ public class AuthenticationTest extends TestCase
|
||||
Authentication result = authenticationManager.authenticate(token);
|
||||
result.setAuthenticated(true);
|
||||
|
||||
String ticket = tc.getNewTicket(getUserName(result), null);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
String ticket = tc.getNewTicket(getUserName(result));
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
@@ -911,7 +911,7 @@ public class AuthenticationTest extends TestCase
|
||||
}
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -921,7 +921,7 @@ public class AuthenticationTest extends TestCase
|
||||
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -931,7 +931,7 @@ public class AuthenticationTest extends TestCase
|
||||
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -954,7 +954,7 @@ public class AuthenticationTest extends TestCase
|
||||
|
||||
try
|
||||
{
|
||||
tc.validateTicket(ticket, null);
|
||||
tc.validateTicket(ticket);
|
||||
assertNotNull(null);
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -982,13 +982,13 @@ public class AuthenticationTest extends TestCase
|
||||
Authentication result = authenticationManager.authenticate(token);
|
||||
result.setAuthenticated(true);
|
||||
|
||||
String ticket = tc.getNewTicket(getUserName(result), null);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
String ticket = tc.getNewTicket(getUserName(result));
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
synchronized (this)
|
||||
{
|
||||
try
|
||||
@@ -1002,8 +1002,8 @@ public class AuthenticationTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
tc.validateTicket(ticket, null);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", null, true), ticket);
|
||||
tc.validateTicket(ticket);
|
||||
assertEquals(ticketComponent.getCurrentTicket("Andy", true), ticket);
|
||||
|
||||
dao.deleteUser("Andy");
|
||||
// assertNull(dao.getUserOrNull("Andy"));
|
||||
@@ -1138,14 +1138,14 @@ public class AuthenticationTest extends TestCase
|
||||
// instance
|
||||
String ticket = authenticationService.getCurrentTicket();
|
||||
// validate our ticket is still valid
|
||||
authenticationService.validate(ticket, null);
|
||||
authenticationService.validate(ticket);
|
||||
assertEquals(ticket, authenticationService.getCurrentTicket());
|
||||
|
||||
// destroy the ticket instance
|
||||
authenticationService.invalidateTicket(ticket, null);
|
||||
authenticationService.invalidateTicket(ticket);
|
||||
try
|
||||
{
|
||||
authenticationService.validate(ticket, null);
|
||||
authenticationService.validate(ticket);
|
||||
fail("Invalid taicket should have been rejected");
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -1187,11 +1187,11 @@ public class AuthenticationTest extends TestCase
|
||||
// validate our ticket is still valid
|
||||
|
||||
authenticationService.clearCurrentSecurityContext();
|
||||
authenticationService.validate(ticket, null);
|
||||
authenticationService.validate(ticket);
|
||||
assertEquals(ticket, authenticationService.getCurrentTicket());
|
||||
|
||||
// destroy the ticket instance
|
||||
authenticationService.invalidateTicket(ticket, null);
|
||||
authenticationService.invalidateTicket(ticket);
|
||||
|
||||
Authentication current = authenticationComponent.getCurrentAuthentication();
|
||||
if (current != null)
|
||||
@@ -1202,7 +1202,7 @@ public class AuthenticationTest extends TestCase
|
||||
|
||||
try
|
||||
{
|
||||
authenticationService.validate(ticket, null);
|
||||
authenticationService.validate(ticket);
|
||||
fail("Invalid ticket should have been rejected");
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -1246,11 +1246,11 @@ public class AuthenticationTest extends TestCase
|
||||
// instance
|
||||
String ticket = authenticationService.getCurrentTicket();
|
||||
// validate our ticket is still valid
|
||||
authenticationService.validate(ticket, null);
|
||||
authenticationService.validate(ticket);
|
||||
assertEquals(ticket, authenticationService.getCurrentTicket());
|
||||
|
||||
// destroy the ticket instance
|
||||
authenticationService.invalidateTicket(ticket, null);
|
||||
authenticationService.invalidateTicket(ticket);
|
||||
|
||||
Authentication current = authenticationComponent.getCurrentAuthentication();
|
||||
if (current != null)
|
||||
@@ -1306,11 +1306,11 @@ public class AuthenticationTest extends TestCase
|
||||
// instance
|
||||
String ticket = authenticationService.getCurrentTicket();
|
||||
// validate our ticket is still valid
|
||||
authenticationService.validate(ticket, null);
|
||||
authenticationService.validate(ticket);
|
||||
assertEquals(ticket, authenticationService.getCurrentTicket());
|
||||
|
||||
// destroy the ticket instance
|
||||
authenticationService.invalidateTicket(ticket, null);
|
||||
authenticationService.invalidateTicket(ticket);
|
||||
|
||||
Authentication current = authenticationComponent.getCurrentAuthentication();
|
||||
if (current != null)
|
||||
@@ -1328,48 +1328,6 @@ public class AuthenticationTest extends TestCase
|
||||
// assertNull(dao.getUserOrNull("Andy"));
|
||||
}
|
||||
|
||||
public void testAuthenticationServiceSessionIds()
|
||||
{
|
||||
// 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());
|
||||
|
||||
// Get the user's ticket and associate it with "AndySessionId"
|
||||
String andyTicket = authenticationService.getCurrentTicket("AndySessionId");
|
||||
|
||||
// Now validate the ticket in another session
|
||||
authenticationService.validate(andyTicket, "DaveSessionId");
|
||||
|
||||
assertEquals(andyTicket, authenticationService.getCurrentTicket());
|
||||
|
||||
// Invalidate it in that session
|
||||
authenticationService.invalidateTicket(andyTicket, "DaveSessionId");
|
||||
|
||||
// Make sure we don't get that ticket again in the same session
|
||||
assertNotSame(andyTicket, authenticationService.getCurrentTicket("DaveSessionId"));
|
||||
|
||||
// The ticket should still validate in the other session
|
||||
authenticationService.validate(andyTicket, "AndySessionId");
|
||||
|
||||
// When we invalidate it in the other session, the ticket should be invalidated globally
|
||||
authenticationService.invalidateTicket(andyTicket, "AndySessionId");
|
||||
|
||||
try
|
||||
{
|
||||
authenticationService.validate(andyTicket, null);
|
||||
fail("Invalid ticket should have been rejected");
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testPubAuthenticationService1()
|
||||
{
|
||||
authenticationComponent.setSystemUserAsCurrentUser();
|
||||
@@ -1510,14 +1468,14 @@ public class AuthenticationTest extends TestCase
|
||||
assertNull(authenticationComponent.getCurrentAuthentication());
|
||||
|
||||
// validate our ticket is still valid
|
||||
pubAuthenticationService.validate(ticket, null);
|
||||
pubAuthenticationService.validate(ticket);
|
||||
assertEquals(ticket, authenticationService.getCurrentTicket());
|
||||
|
||||
// destroy the ticket instance
|
||||
pubAuthenticationService.invalidateTicket(ticket, null);
|
||||
pubAuthenticationService.invalidateTicket(ticket);
|
||||
try
|
||||
{
|
||||
pubAuthenticationService.validate(ticket, null);
|
||||
pubAuthenticationService.validate(ticket);
|
||||
fail("Ticket should not validate");
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -1579,11 +1537,11 @@ public class AuthenticationTest extends TestCase
|
||||
// instance
|
||||
String ticket = pubAuthenticationService.getCurrentTicket();
|
||||
// validate our ticket is still valid
|
||||
pubAuthenticationService.validate(ticket, null);
|
||||
pubAuthenticationService.validate(ticket);
|
||||
assertEquals(ticket, authenticationService.getCurrentTicket());
|
||||
|
||||
// destroy the ticket instance
|
||||
pubAuthenticationService.invalidateTicket(ticket, null);
|
||||
pubAuthenticationService.invalidateTicket(ticket);
|
||||
|
||||
}
|
||||
|
||||
@@ -1640,11 +1598,11 @@ public class AuthenticationTest extends TestCase
|
||||
// instance
|
||||
String ticket = pubAuthenticationService.getCurrentTicket();
|
||||
// validate our ticket is still valid
|
||||
pubAuthenticationService.validate(ticket, null);
|
||||
pubAuthenticationService.validate(ticket);
|
||||
assertEquals(ticket, authenticationService.getCurrentTicket());
|
||||
|
||||
// destroy the ticket instance
|
||||
pubAuthenticationService.invalidateTicket(ticket, null);
|
||||
pubAuthenticationService.invalidateTicket(ticket);
|
||||
|
||||
authenticationComponent.clearCurrentSecurityContext();
|
||||
|
||||
|
@@ -299,11 +299,11 @@ public class ChainingAuthenticationServiceTest extends TestCase
|
||||
String ticket = as.getCurrentTicket();
|
||||
assertTrue(ticket == as.getCurrentTicket());
|
||||
|
||||
as.validate(ticket, null);
|
||||
as.invalidateTicket(ticket, null);
|
||||
as.validate(ticket);
|
||||
as.invalidateTicket(ticket);
|
||||
try
|
||||
{
|
||||
as.validate(ticket, null);
|
||||
as.validate(ticket);
|
||||
fail();
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -312,11 +312,11 @@ public class ChainingAuthenticationServiceTest extends TestCase
|
||||
}
|
||||
|
||||
ticket = as.getCurrentTicket();
|
||||
as.validate(ticket, null);
|
||||
as.validate(ticket);
|
||||
as.invalidateUserSession("andy");
|
||||
try
|
||||
{
|
||||
as.validate(ticket, null);
|
||||
as.validate(ticket);
|
||||
fail();
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -664,11 +664,11 @@ public class ChainingAuthenticationServiceTest extends TestCase
|
||||
String ticket = as.getCurrentTicket();
|
||||
assertTrue(ticket == as.getCurrentTicket());
|
||||
|
||||
as.validate(ticket, null);
|
||||
as.invalidateTicket(ticket, null);
|
||||
as.validate(ticket);
|
||||
as.invalidateTicket(ticket);
|
||||
try
|
||||
{
|
||||
as.validate(ticket, null);
|
||||
as.validate(ticket);
|
||||
fail();
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
@@ -677,11 +677,11 @@ public class ChainingAuthenticationServiceTest extends TestCase
|
||||
}
|
||||
|
||||
ticket = as.getCurrentTicket();
|
||||
as.validate(ticket, null);
|
||||
as.validate(ticket);
|
||||
as.invalidateUserSession("andy");
|
||||
try
|
||||
{
|
||||
as.validate(ticket, null);
|
||||
as.validate(ticket);
|
||||
fail();
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
|
@@ -278,7 +278,7 @@ public class TestAuthenticationServiceImpl implements MutableAuthenticationServi
|
||||
userToTicket.remove(userName);
|
||||
}
|
||||
|
||||
public void invalidateTicket(String ticket, String sessionId) throws AuthenticationException
|
||||
public void invalidateTicket(String ticket) throws AuthenticationException
|
||||
{
|
||||
String userToRemove = null;
|
||||
for (String user : userToTicket.keySet())
|
||||
@@ -296,7 +296,7 @@ public class TestAuthenticationServiceImpl implements MutableAuthenticationServi
|
||||
|
||||
}
|
||||
|
||||
public void validate(String ticket, String sessionId) throws AuthenticationException
|
||||
public void validate(String ticket) throws AuthenticationException
|
||||
{
|
||||
String userToSet = null;
|
||||
for (String user : userToTicket.keySet())
|
||||
@@ -319,12 +319,6 @@ public class TestAuthenticationServiceImpl implements MutableAuthenticationServi
|
||||
}
|
||||
|
||||
public String getCurrentTicket()
|
||||
{
|
||||
return getCurrentTicket(null);
|
||||
}
|
||||
|
||||
// TODO: Fix this up
|
||||
public String getCurrentTicket(String sessionId)
|
||||
{
|
||||
String currentUser = getCurrentUserName();
|
||||
String ticket = userToTicket.get(currentUser);
|
||||
@@ -336,7 +330,7 @@ public class TestAuthenticationServiceImpl implements MutableAuthenticationServi
|
||||
return ticket;
|
||||
}
|
||||
|
||||
public String getNewTicket(String sessionId)
|
||||
public String getNewTicket()
|
||||
{
|
||||
String currentUser = getCurrentUserName();
|
||||
String ticket = userToTicket.get(currentUser);
|
||||
|
Reference in New Issue
Block a user