mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.2 to HEAD
8144: Fix for AR-1850, AR-2046 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8487 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -30,6 +30,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
|
||||
/**
|
||||
* This class implements a simple chaining authentication service.
|
||||
@@ -51,7 +52,7 @@ import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
*
|
||||
* @author Andy Hind
|
||||
*/
|
||||
public class ChainingAuthenticationServiceImpl implements AuthenticationService
|
||||
public class ChainingAuthenticationServiceImpl extends AbstractAuthenticationService
|
||||
{
|
||||
|
||||
private List<AuthenticationService> authenticationServices;
|
||||
@@ -157,6 +158,7 @@ public class ChainingAuthenticationServiceImpl implements AuthenticationService
|
||||
|
||||
public void authenticate(String userName, char[] password) throws AuthenticationException
|
||||
{
|
||||
preAuthenticationCheck(userName);
|
||||
for (AuthenticationService authService : getUsableAuthenticationServices())
|
||||
{
|
||||
try
|
||||
@@ -175,6 +177,7 @@ public class ChainingAuthenticationServiceImpl implements AuthenticationService
|
||||
|
||||
public void authenticateAsGuest() throws AuthenticationException
|
||||
{
|
||||
preAuthenticationCheck(PermissionService.GUEST_AUTHORITY);
|
||||
for (AuthenticationService authService : getUsableAuthenticationServices())
|
||||
{
|
||||
try
|
||||
@@ -411,4 +414,57 @@ public class ChainingAuthenticationServiceImpl implements AuthenticationService
|
||||
return domains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getUsersWithTickets(boolean nonExpiredOnly)
|
||||
{
|
||||
HashSet<String> users = new HashSet<String>();
|
||||
for (AuthenticationService authService : getUsableAuthenticationServices())
|
||||
{
|
||||
if(authService instanceof AbstractAuthenticationService)
|
||||
{
|
||||
users.addAll( ((AbstractAuthenticationService)authService).getUsersWithTickets(nonExpiredOnly));
|
||||
}
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countTickets(boolean nonExpiredOnly)
|
||||
{
|
||||
int count = 0;
|
||||
for(TicketComponent tc : getTicketComponents())
|
||||
{
|
||||
count += tc.countTickets(nonExpiredOnly);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int invalidateTickets(boolean nonExpiredOnly)
|
||||
{
|
||||
int count = 0;
|
||||
for (AuthenticationService authService : getUsableAuthenticationServices())
|
||||
{
|
||||
if(authService instanceof AbstractAuthenticationService)
|
||||
{
|
||||
count += ((AbstractAuthenticationService)authService).invalidateTickets(nonExpiredOnly);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TicketComponent> getTicketComponents()
|
||||
{
|
||||
Set<TicketComponent> tcs = new HashSet<TicketComponent>();
|
||||
for (AuthenticationService authService : getUsableAuthenticationServices())
|
||||
{
|
||||
if(authService instanceof AbstractAuthenticationService)
|
||||
{
|
||||
tcs.addAll(((AbstractAuthenticationService)authService).getTicketComponents());
|
||||
}
|
||||
}
|
||||
return tcs;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user