mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +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:
@@ -33,6 +33,7 @@
|
||||
<%@ page import="org.alfresco.service.cmr.security.PersonService" %>
|
||||
<%@ page import="org.alfresco.service.cmr.security.PermissionService" %>
|
||||
<%@ page import="org.alfresco.service.cmr.repository.NodeRef" %>
|
||||
<%@ page import="org.alfresco.repo.security.authentication.AuthenticationException" %>
|
||||
<%@ page import="org.alfresco.config.ConfigService" %>
|
||||
<%@ page import="org.alfresco.web.app.servlet.AuthenticationHelper" %>
|
||||
<%@ page import="org.alfresco.web.app.servlet.FacesHelper" %>
|
||||
@@ -49,16 +50,40 @@ ConfigService configService = (ConfigService)context.getBean("webClientConfigSer
|
||||
ClientConfigElement configElement = (ClientConfigElement)configService.getGlobalConfig().getConfigElement("client");
|
||||
String location = configElement.getInitialLocation();
|
||||
|
||||
AuthenticationService authService = (AuthenticationService)context.getBean("AuthenticationService");
|
||||
|
||||
// override with the users preference if they have one
|
||||
User user = (User)session.getAttribute(AuthenticationHelper.AUTHENTICATION_USER);
|
||||
if (user != null)
|
||||
{
|
||||
// ensure construction of the FacesContext before attemping a service call
|
||||
FacesContext fc = FacesHelper.getFacesContext(request, response, application);
|
||||
String preference = (String)PreferencesService.getPreferences(fc).getValue("start-location");
|
||||
if (preference != null)
|
||||
UserTransaction tx = ((TransactionService)context.getBean("TransactionService")).getUserTransaction();;
|
||||
tx.begin();
|
||||
try
|
||||
{
|
||||
authService.validate(user.getTicket());
|
||||
|
||||
// ensure construction of the FacesContext before attemping a service call
|
||||
FacesContext fc = FacesHelper.getFacesContext(request, response, application);
|
||||
String preference = (String)PreferencesService.getPreferences(fc).getValue("start-location");
|
||||
if (preference != null)
|
||||
{
|
||||
location = preference;
|
||||
}
|
||||
|
||||
tx.commit();
|
||||
}
|
||||
catch (AuthenticationException authErr)
|
||||
{
|
||||
location = preference;
|
||||
try { tx.rollback(); } catch (Throwable tex) {}
|
||||
|
||||
// expired ticket
|
||||
AuthenticationService unpAuth = (AuthenticationService)context.getBean("authenticationService");
|
||||
unpAuth.invalidateTicket(unpAuth.getCurrentTicket());
|
||||
unpAuth.clearCurrentSecurityContext();
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
try { tx.rollback(); } catch (Throwable tex) {}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -67,7 +92,6 @@ else
|
||||
tx.begin();
|
||||
try
|
||||
{
|
||||
AuthenticationService authService = (AuthenticationService)context.getBean("AuthenticationService");
|
||||
authService.authenticateAsGuest();
|
||||
PersonService personService = (PersonService)context.getBean("personService");
|
||||
NodeRef guestRef = personService.getPerson(PermissionService.GUEST_AUTHORITY);
|
||||
|
Reference in New Issue
Block a user