View Javadoc
1   /******************************************************************************
2    * BSAccountMan - This Interface is the API into the BuckoSoft Account Manager
3    * 
4    * BSAccount - BuckoSoft Web Account Manager 
5    * Copyright(c) 2007 - Dick Balaska and BuckoSoft, Corp.
6    * 
7    */
8   package com.buckosoft.BSAccount;
9   
10  import javax.servlet.http.HttpServletRequest;
11  
12  import com.buckosoft.BSAccount.domain.BSAccount;
13  import com.buckosoft.BSAccount.domain.BSAccountUser;
14  import com.buckosoft.BSAccount.domain.BSAccountUserWebSession;
15  
16  /** This Interface is the API into the BuckoSoft Account Manager.
17   * This API deals in BSAccount objects.
18   * @see BSAccount
19   * @author dick
20   *
21   */
22  public interface BSAccountMan {
23  	
24  	BSAccountUserWebSession	getUserWebSession(HttpServletRequest request);
25  	
26  	boolean isUserWebSession(HttpServletRequest request);
27  
28  	/** Get a user account, given his username and password.  This effectively logs the user in. 
29  	 * @param username His registered BuckoSoft username
30  	 * @param password The cleartext password that the user typed in.  NB: BSAccount passwords <i>are</i> encrypted in the database.
31  	 * @return The user's BSAccount or not if username and password don't match the one in the system.
32  	 */
33  	BSAccount	getAccount(String username, String password);
34  	
35  	BSAccountUser	getUser(BSAccount account);
36  	
37  	/** Create a new anonymous BSAccountUSer
38  	 * @return The new user
39  	 */
40  	BSAccountUser getNewUser();
41  
42  	
43  	String getAppName();
44  	void setAppName(String appName);
45  	
46  	/** Given a logged in account, return a key that can be used by another app to retrieve this logged in account.
47  	 * This is used by BSAccountMan to 
48  	 * @param account The BSAccount that wants to jump apps
49  	 * @return A random number or 0 if the account is not logged in
50  	 */
51  	long getAppJumper(BSAccount account);
52  }