Added session id to the result of authentication call. Updated Java web service client to pass session id on cookieif present in authentication details.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5075 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2007-02-08 11:05:21 +00:00
parent 7e64c93d6b
commit 05927316da
5 changed files with 67 additions and 6 deletions

View File

@@ -26,7 +26,9 @@ import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.transaction.UserTransaction;
import javax.xml.rpc.server.ServletEndpointContext;
import org.alfresco.repo.webservice.axis.QueryConfigHandler;
import org.alfresco.repo.webservice.types.AssociationDefinition;
@@ -520,7 +522,7 @@ public class Utils
* @return a UserTransaction
*/
public static UserTransaction getUserTransaction(MessageContext msgContext)
{
{
// get the service regsistry
ServiceRegistry svcReg = (ServiceRegistry) getSpringContext(msgContext)
.getBean(ServiceRegistry.SERVICE_REGISTRY);
@@ -528,6 +530,26 @@ public class Utils
TransactionService transactionService = svcReg.getTransactionService();
return transactionService.getUserTransaction();
}
/**
* Gets the current http session id
*
* @return the current http session id, null if none found
*/
public static String getSessionId()
{
String result = null;
ServletEndpointContext endpointContext = (ServletEndpointContext)MessageContext.getCurrentContext().getProperty("servletEndpointContext");
if (endpointContext != null)
{
HttpSession session = endpointContext.getHttpSession();
if (session != null)
{
result = session.getId();
}
}
return result;
}
/**
* Returns the value of the <code>fetchSize</code> from the

View File

@@ -19,6 +19,7 @@ package org.alfresco.repo.webservice.authentication;
import java.rmi.RemoteException;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.repo.webservice.Utils;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -63,8 +64,8 @@ public class AuthenticationWebService implements AuthenticationServiceSoapPort
{
logger.debug("Issued ticket '" + ticket + "' for '" + username + "'");
}
return new AuthenticationResult(username, ticket);
return new AuthenticationResult(username, ticket, Utils.getSessionId());
}
catch (AuthenticationException ae)
{

View File

@@ -41,7 +41,8 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
*/
public class TicketCallbackSpringHandler extends BasicHandler
{
private static final Log logger = LogFactory.getLog(TicketCallbackSpringHandler.class);
@SuppressWarnings("unused")
private static final Log logger = LogFactory.getLog(TicketCallbackSpringHandler.class);
private static final String BEAN_NAME = "ticketCallbackHandler";
private static final long serialVersionUID = -135125831180499667L;