1 package org.restafarian.core.security;
2
3 import javax.servlet.ServletContext;
4 import javax.servlet.http.HttpServletRequest;
5 import javax.servlet.http.HttpServletResponse;
6
7 import org.apache.commons.configuration.Configuration;
8 import org.restafarian.core.beans.Person;
9
10 /***
11 * <p>This interface specifies the required methods for a user manager.</p>
12 */
13 public interface UserManager {
14
15 /***
16 * <p>Initializes the module using the configuration.</p>
17 *
18 * @param context the <code>ServletContext</code> object
19 * @param config the <code>Configuration</code> object
20 */
21 public void init(ServletContext context, Configuration config);
22
23 /***
24 * <p>Returns the currently authenticated user, or null, if there is
25 * no user currently authenticated.</p>
26 *
27 * @param req the <code>HttpServletRequest</code> object
28 * @return the currently authenticated user
29 */
30 public Person getAuthenticatedUser(HttpServletRequest req);
31
32 /***
33 * <p>Sets the currently authenticated user.</p>
34 *
35 * @param req the <code>HttpServletRequest</code> object
36 * @param res the <code>HttpServletResponse</code> object
37 * @param user the currently authenticated user
38 */
39 public void setAuthenticatedUser(HttpServletRequest req, HttpServletResponse res, Person user);
40 }