KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > security > LogonController


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
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. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.security;
21
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24
25 import javax.servlet.http.HttpServletRequest JavaDoc;
26 import javax.servlet.http.HttpServletResponse JavaDoc;
27 import javax.servlet.http.HttpSession JavaDoc;
28
29 import com.sslexplorer.boot.RequestHandlerRequest;
30 import com.sslexplorer.boot.RequestHandlerResponse;
31 import com.sslexplorer.properties.PropertyProfile;
32
33 /**
34  * @author Brett Smith <brett@3sp.com>
35  */

36 public interface LogonController {
37     public final static int ACCOUNT_UNKNOWN = -1;
38     public final static int ACCOUNT_GRANTED = 0;
39     public final static int ACCOUNT_DISABLED = 1;
40     public final static int ACCOUNT_LOCKED = 2;
41     public final static int ACCOUNT_REVOKED = 3;
42     public final static int ACCOUNT_ACTIVE = 4;
43     public final static int NOT_LOGGED_ON = 0;
44     public final static int LOGGED_ON = 1;
45     public final static int INVALID_TICKET = 2;
46
47     /**
48      * Initialize the controller with the user and system databases.
49      *
50      * @param udb
51      * @param sdb
52      */

53     public abstract void init();
54
55     public abstract boolean isAdministrator(User principal);
56
57     public abstract int addSessionTimeoutBlock(HttpSession JavaDoc session, String JavaDoc reason);
58
59     public abstract void removeSessionTimeoutBlock(HttpSession JavaDoc session, int sessionTimeoutBlockId);
60
61     public abstract void logoffSession(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws SecurityErrorException;
62
63     public abstract List JavaDoc getSessionInfo(String JavaDoc username, int sessionType);
64
65     public abstract SessionInfo getSessionInfo(String JavaDoc logonTicket);
66
67     public abstract int getUserStatus(User user) throws Exception JavaDoc;
68
69     /*public abstract String logonClient(HttpServletRequest request, HttpServletResponse response, String username, String password,
70                     Properties properties) throws InvalidTicketException, UserDatabaseException, InvalidLoginCredentialsException,
71                     AccountLockedException, UnknownHostException;
72     public User doClientLogon(String username, String password) throws UserDatabaseException, InvalidLoginCredentialsException, AccountLockedException;
73     */

74
75     public abstract void initialiseSession(HttpSession JavaDoc session, User user) throws UserDatabaseException;
76
77     public void resetSessionTimeout(User user, PropertyProfile profile, HttpSession JavaDoc session);
78
79     public abstract AccountLock checkForAccountLock(String JavaDoc username, String JavaDoc realmName) throws SecurityErrorException, AccountLockedException;
80
81     public abstract AccountLock logonFailed(String JavaDoc username, String JavaDoc realmName, AccountLock lock) throws SecurityErrorException, AccountLockedException;
82
83     /*public abstract void removeVPNClient(VPNSession session);(/)*/
84
85     public abstract void logoff(String JavaDoc ticket);
86
87     /*public abstract VPNSession getPrimaryVPNSession(List vpnSessions);
88
89     public abstract String setupVPNSession(SessionInfo sessionInfo)
90                     throws InvalidTicketException;
91
92     public abstract VPNSession getVPNSessionByTicket(String ticket);
93
94     public abstract List getVPNSessionsByLogon(HttpServletRequest request);
95
96     public abstract List getVPNSessionsByLogon(String ticket);
97
98     public abstract VPNSession getPendingVPNSession(HttpServletRequest request);
99
100     public abstract VPNSession getPendingVPNSession(String ticket);*/

101
102     public abstract Map JavaDoc getActiveSessions();
103
104     /*public abstract void deregisterVPNClient(VPNSession vpnSession) throws IllegalStateException;*/
105
106     /*public abstract String registerVPNClient(HttpServletRequest request, String authorizationTicket, int clientPort,
107                     Properties properties, int type) throws InvalidTicketException;
108 */

109     /*public abstract boolean waitForClientRegistration(String ticket, int timeout);*/
110
111     public abstract User getUser(HttpSession JavaDoc session, String JavaDoc logonTicket) throws SecurityErrorException;
112
113     public abstract User getUser(HttpServletRequest JavaDoc request) throws SecurityErrorException;
114
115     public abstract User getUser(HttpServletRequest JavaDoc request, String JavaDoc logonTicket) throws SecurityErrorException;
116
117     public abstract int hasClientLoggedOn(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
118                     throws SecurityErrorException;
119
120     /*public abstract VPNSession getVPNSession(HttpServletRequest request);
121
122     public abstract boolean verifyPendingVPNAuthorization(String ticket);
123
124     public abstract boolean verifyPendingVPNAuthorization(HttpServletRequest request);
125 */

126
127     public abstract void unlockUser(String JavaDoc username);
128
129 /* public abstract void waitForFirstClientHearbeat(HttpServletRequest request) throws Exception;*/
130
131     /**
132      * @param request
133      * @param response
134      * @param authSession
135      */

136     public abstract void logon(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response, AuthenticationScheme authSession)
137                     throws Exception JavaDoc;
138
139     /**
140      * @param scheme
141      * @return
142      */

143     public abstract char[] getPasswordFromCredentials(AuthenticationScheme scheme);
144
145     /**
146      * @param session
147      * @return
148      */

149     /*public abstract boolean isVPNSessionValid(VPNSession session);*/
150
151     /**
152      * @param request
153      * @return
154      */

155     public abstract SessionInfo getSessionInfo(HttpServletRequest JavaDoc request) ;
156     
157     public abstract SessionInfo getSessionInfo(HttpSession JavaDoc session) ;
158
159
160     public abstract SessionInfo getSessionInfoBySessionId(String JavaDoc sessionId);
161
162     public void addCookies(RequestHandlerRequest request,
163             RequestHandlerResponse response, String JavaDoc logonTicket, SessionInfo session);
164
165     public void addSession(String JavaDoc logonTicket, SessionInfo info, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response);
166
167     public abstract String JavaDoc checkLogonAllowed(User username);
168     
169     public void attachSession(String JavaDoc sessionId, SessionInfo session);
170     
171     public void registerAuthorizationTicket(String JavaDoc ticket, SessionInfo session);
172     
173     public SessionInfo removeAuthorizationTicket(String JavaDoc ticket);
174     
175     public SessionInfo getAuthorizationTicket(String JavaDoc ticket);
176     
177     /**
178      * Method to clear the policy cash, remove the menu items form
179      * the session and reset the user in the session.
180      * @param request
181      */

182     public void applyMenuItemChanges(HttpServletRequest JavaDoc request);
183
184 }
185
Popular Tags