mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Moving to root below branch label
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2005 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* 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.example.webservice.TicketHolder;
|
||||
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)
|
||||
{
|
||||
throw new AuthenticationFault(100, ae.getMessage());
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
throw new AuthenticationFault(0, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.webservice.authentication.AuthenticationServiceSoapPort#endSession()
|
||||
*/
|
||||
public void endSession() throws RemoteException, AuthenticationFault
|
||||
{
|
||||
try
|
||||
{
|
||||
String ticket = TicketHolder.ticket;
|
||||
if (ticket != null)
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user