mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fixed fallout from PersonService-personService
- WebDAV wasn't working - Couldn't login git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2440 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -30,14 +30,13 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
|
import org.alfresco.service.cmr.security.NoSuchPersonException;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||||
@@ -60,7 +59,6 @@ public class AuthenticationFilter implements Filter
|
|||||||
// Various services required by NTLM authenticator
|
// Various services required by NTLM authenticator
|
||||||
|
|
||||||
private AuthenticationService m_authService;
|
private AuthenticationService m_authService;
|
||||||
private AuthenticationComponent m_authComponent;
|
|
||||||
private PersonService m_personService;
|
private PersonService m_personService;
|
||||||
private NodeService m_nodeService;
|
private NodeService m_nodeService;
|
||||||
|
|
||||||
@@ -82,10 +80,8 @@ public class AuthenticationFilter implements Filter
|
|||||||
|
|
||||||
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||||
m_nodeService = serviceRegistry.getNodeService();
|
m_nodeService = serviceRegistry.getNodeService();
|
||||||
|
m_authService = serviceRegistry.getAuthenticationService();
|
||||||
m_authService = (AuthenticationService) ctx.getBean("authenticationService");
|
m_personService = (PersonService) ctx.getBean("PersonService"); // transactional and permission-checked
|
||||||
m_authComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
|
|
||||||
m_personService = (PersonService) ctx.getBean("personService");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,15 +137,12 @@ public class AuthenticationFilter implements Filter
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Authenticate the user
|
// Authenticate the user
|
||||||
|
|
||||||
m_authService.authenticate(username, password.toCharArray());
|
m_authService.authenticate(username, password.toCharArray());
|
||||||
|
|
||||||
// Get the users home folder
|
// Get the user node and home folder
|
||||||
|
NodeRef personNodeRef = m_personService.getPerson(username);
|
||||||
NodeRef homeSpaceRef = (NodeRef) m_nodeService.getProperty(m_personService.getPerson(username), ContentModel.PROP_HOMEFOLDER);
|
NodeRef homeSpaceRef = (NodeRef) m_nodeService.getProperty(personNodeRef, ContentModel.PROP_HOMEFOLDER);
|
||||||
|
|
||||||
// Setup User object and Home space ID etc.
|
// Setup User object and Home space ID etc.
|
||||||
|
|
||||||
user = new WebDAVUser(username, m_authService.getCurrentTicket(), homeSpaceRef);
|
user = new WebDAVUser(username, m_authService.getCurrentTicket(), homeSpaceRef);
|
||||||
|
|
||||||
httpReq.getSession().setAttribute(AUTHENTICATION_USER, user);
|
httpReq.getSession().setAttribute(AUTHENTICATION_USER, user);
|
||||||
@@ -158,6 +151,10 @@ public class AuthenticationFilter implements Filter
|
|||||||
{
|
{
|
||||||
// Do nothing, user object will be null
|
// Do nothing, user object will be null
|
||||||
}
|
}
|
||||||
|
catch (NoSuchPersonException e)
|
||||||
|
{
|
||||||
|
// Do nothing, user object will be null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the user is authenticated, if not then prompt again
|
// Check if the user is authenticated, if not then prompt again
|
||||||
|
Reference in New Issue
Block a user