View Javadoc

1   /** 2007, Digitalis Informatica. All rights reserved.
2    * 
3    * Distribuicao e Gestao de Informatica, Lda.
4    * Estrada de Paco de Arcos num.9 - Piso -1
5    * 2780-666 Paco de Arcos
6    * Telefone: (351) 21 4408990
7    * Fax: (351) 21 4408999
8    * http://www.digitalis.pt 
9    */
10  
11  package pt.digitalis.dif.controller.security.managers;
12  
13  import pt.digitalis.dif.controller.interfaces.IDIFSession;
14  import pt.digitalis.dif.exception.security.AuthenticationManagerException;
15  
16  /**
17   * Defines the behavior for a session manager.
18   * 
19   * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a><br/>
20   * @author Rodrigo Gonçalves <a href="mailto:rgoncalves@digitalis.pt">rgoncalves@digitalis.pt</a><br/>
21   * @created Dec 11, 2007
22   */
23  public interface ISessionManager {
24  
25      /**
26       * Checks if a given session is registered on the framework.
27       * 
28       * @param sessionID
29       *            the session id
30       * @return T if a session with this ID is present and active.
31       */
32      public boolean isSessionPresent(String sessionID);
33  
34      /**
35       * Gets a managed session
36       * 
37       * @param sessionID
38       * @return the session object or null if non-existent
39       */
40      public IDIFSession getSession(String sessionID);
41  
42      /**
43       * Creates a new session. If existent returns the matching identifier existing session
44       * 
45       * @param sessionID
46       *            the session id to create
47       * @return the created session
48       */
49      public IDIFSession createSession(String sessionID);
50  
51      /**
52       * Updates an existent session
53       * 
54       * @param session
55       *            the session to update
56       * @return T if the session existed and was updated
57       */
58      public boolean update(IDIFSession session);
59  
60      /**
61       * Performs the log in of a user with a given id on the framework.
62       * 
63       * @param sessionID
64       *            the session identifier
65       * @param userID
66       *            the id of the user to log in
67       * @param password
68       *            the password for the user
69       * @return the updated session object
70       * @throws AuthenticationManagerException
71       *             if the authentication manager can't be accessed to validate the user's credentials
72       */
73      public IDIFSession logIn(String sessionID, String userID, String password) throws AuthenticationManagerException;
74  
75      /**
76       * Performs the log out of a user with a given id on the framework.
77       * 
78       * @param sessionID
79       *            the session id to log out
80       * @return the updated session object
81       */
82      public IDIFSession logOut(String sessionID);
83  }