Merged HEAD-BUG-FIX (Cloud/4.3) to HEAD (Cloud/4.3)

62731: Use RetryingTransactionHelper during authentication as an attempt to fix Oracle build failures during WebService test initialization


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62820 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-19 13:18:04 +00:00
parent 02d54faadc
commit 1608cbbd4b

View File

@@ -56,7 +56,7 @@ public class AuthenticationWebService implements AuthenticationServiceSoapPort
}
/**
* Set the atuthentication component
* Set the authentication component
*
* @param authenticationComponent
*/
@@ -69,20 +69,27 @@ public class AuthenticationWebService implements AuthenticationServiceSoapPort
* @see org.alfresco.repo.webservice.authentication.AuthenticationServiceSoapPort#startSession(java.lang.String,
* java.lang.String)
*/
public AuthenticationResult startSession(String username, String password)
public AuthenticationResult startSession(final String username, final String password)
throws RemoteException, AuthenticationFault
{
try
{
this.authenticationService.authenticate(username, password.toCharArray());
String ticket = this.authenticationService.getCurrentTicket();
if (logger.isDebugEnabled())
RetryingTransactionCallback<AuthenticationResult> callback = new RetryingTransactionCallback<AuthenticationResult>()
{
logger.debug("Issued ticket '" + ticket + "' for '" + username + "'");
}
return new AuthenticationResult(username, ticket, Utils.getSessionId());
public AuthenticationResult execute() throws Throwable
{
authenticationService.authenticate(username, password.toCharArray());
String ticket = authenticationService.getCurrentTicket();
if (logger.isDebugEnabled())
{
logger.debug("Issued ticket '" + ticket + "' for '" + username + "'");
}
return new AuthenticationResult(username, ticket, Utils.getSessionId());
}
};
return Utils.getRetryingTransactionHelper(MessageContext.getCurrentContext()).doInTransaction(callback);
}
catch (AuthenticationException ae)
{
@@ -109,9 +116,9 @@ public class AuthenticationWebService implements AuthenticationServiceSoapPort
{
public Object execute() throws Throwable
{
AuthenticationWebService.this.authenticationComponent.setSystemUserAsCurrentUser();
AuthenticationWebService.this.authenticationService.invalidateTicket(ticket);
AuthenticationWebService.this.authenticationService.clearCurrentSecurityContext();
authenticationComponent.setSystemUserAsCurrentUser();
authenticationService.invalidateTicket(ticket);
authenticationService.clearCurrentSecurityContext();
if (logger.isDebugEnabled())
{