mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- Updated web services, SDK and web client where appropraite - Patch added to migrate existing rules - Entire rule service can now be disabled programmatically - Rule service is now disabled during the patching process - StoreEnum and languageEnum types removed from web service interfaces - Multiple rule types now supported in the repo (but not in the UI) - Removed owning node ref from action and rule .. now calculated from methods on the rule service git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3464 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
106 lines
3.5 KiB
Java
106 lines
3.5 KiB
Java
/*
|
|
* Copyright (C) 2005 Alfresco, Inc.
|
|
*
|
|
* Licensed under the Mozilla Public License version 1.1
|
|
* with a permitted attribution clause. You may obtain a
|
|
* copy of the License at
|
|
*
|
|
* http://www.alfresco.org/legal/license.txt
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
* either express or implied. See the License for the specific
|
|
* language governing permissions and limitations under the
|
|
* License.
|
|
*/
|
|
package org.alfresco.repo.webservice.authentication;
|
|
|
|
import java.rmi.RemoteException;
|
|
|
|
import org.alfresco.repo.security.authentication.AuthenticationException;
|
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
/**
|
|
* Web service implementation of the AuthenticationService. The WSDL for this
|
|
* service can be accessed from
|
|
* http://localhost:8080/alfresco/wsdl/authentication-service.wsdl
|
|
*
|
|
* @author gavinc
|
|
*/
|
|
public class AuthenticationWebService implements AuthenticationServiceSoapPort
|
|
{
|
|
private static Log logger = LogFactory.getLog(AuthenticationWebService.class);
|
|
|
|
private AuthenticationService authenticationService;
|
|
|
|
/**
|
|
* Sets the AuthenticationService instance to use
|
|
*
|
|
* @param authenticationSvc
|
|
* The AuthenticationService
|
|
*/
|
|
public void setAuthenticationService(AuthenticationService authenticationSvc)
|
|
{
|
|
this.authenticationService = authenticationSvc;
|
|
}
|
|
|
|
/**
|
|
* @see org.alfresco.repo.webservice.authentication.AuthenticationServiceSoapPort#startSession(java.lang.String,
|
|
* java.lang.String)
|
|
*/
|
|
public AuthenticationResult startSession(String username, String password)
|
|
throws RemoteException, AuthenticationFault
|
|
{
|
|
try
|
|
{
|
|
this.authenticationService.authenticate(username, password.toCharArray());
|
|
String ticket = this.authenticationService.getCurrentTicket();
|
|
|
|
if (logger.isDebugEnabled())
|
|
{
|
|
logger.debug("Issued ticket '" + ticket + "' for '" + username + "'");
|
|
}
|
|
|
|
return new AuthenticationResult(username, ticket);
|
|
}
|
|
catch (AuthenticationException ae)
|
|
{
|
|
ae.printStackTrace();
|
|
throw new AuthenticationFault(100, ae.getMessage());
|
|
}
|
|
catch (Throwable e)
|
|
{
|
|
e.printStackTrace();
|
|
throw new AuthenticationFault(0, e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @see org.alfresco.repo.webservice.authentication.AuthenticationServiceSoapPort#endSession()
|
|
*/
|
|
public void endSession(String ticket) throws RemoteException, AuthenticationFault
|
|
{
|
|
try
|
|
{
|
|
if (ticket != null)
|
|
{
|
|
this.authenticationService.validate(ticket);
|
|
this.authenticationService.invalidateTicket(ticket);
|
|
this.authenticationService.clearCurrentSecurityContext();
|
|
|
|
if (logger.isDebugEnabled())
|
|
{
|
|
logger.debug("Session ended for ticket '" + ticket + "'");
|
|
}
|
|
}
|
|
}
|
|
catch (Throwable e)
|
|
{
|
|
throw new AuthenticationFault(0, e.getMessage());
|
|
}
|
|
}
|
|
}
|