View Javadoc

1   /**
2    * Copyright 2005-2006 the original author or authors.
3    *
4    * Licensed under the Gnu General Pubic License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with
6    * the License. You may obtain a copy of the License at
7    *
8    *      http://www.opensource.org/licenses/gpl-license.php
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13   * See the Gnu General Public License for more details.
14   */
15  package org.figure8.join.services.remoting;
16  
17  import org.figure8.join.services.security.InvalidLoginException;
18  
19  import java.rmi.Remote;
20  import java.rmi.RemoteException;
21  /**
22   * Base interface for remote services interface and implementation. This
23   * interface should be extend where authentication and authorization is required
24   * for remote services execution.
25   * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
26   * @version $Revision: 1.2 $
27   */
28  public interface AuthenticatedService extends Remote{
29  
30     // Public -------------------------------------------------------------------
31  
32     /**
33      * Authenticates a remote user onto Join application. In case of successfull
34      * authentication, this method returns a token that should be used later as
35      * a parameter for calling services required authorization.
36      * @param username Login of user for authentication
37      * @param password Password of corresponding user
38      * @return An authentication token to reuse later during service call
39      * @throws InvalidLoginException if user cannot be logged
40      * @throws RemoteException if an exception occurs during the remote conversation
41      */
42     public abstract String login(String username, String password) throws InvalidLoginException, RemoteException;
43  
44     /**
45      * Logs out from Join application the user corresponding to the supplied token.
46      * @param token An authentication token obtained with <code>login()</code> method.
47      * @throws RemoteException if an exception occurs during the remote conversation
48      */
49     public abstract void logout(String token) throws RemoteException;
50  }