KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > security > login > SessionLogin


1 /*
2  * CoadunationLib: The coaduntion implementation library.
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * SessionLogin.java
20  *
21  * This class is responsible for setting up a session for a user.
22  */

23
24 // The package path for the session
25
package com.rift.coad.lib.security.login;
26
27 // coadunation imports
28
import com.rift.coad.lib.security.UserSession;
29
30 /**
31  * This class is responsible for setting up a session for a user.
32  *
33  * @author Brett Chaldecott
34  */

35 public class SessionLogin {
36     
37     // The classes private member variables.
38
private LoginInfoHandler infoHandler = null;
39     private UserSession user = null;
40     
41     /**
42      * Creates a new instance of SessionLogin
43      *
44      * @param infoHandler The reference to the class that will gather the
45      * information required for the authentication request.
46      */

47     public SessionLogin(LoginInfoHandler infoHandler) {
48         this.infoHandler = infoHandler;
49     }
50     
51     
52     /**
53      * This method will process the login request.
54      *
55      * @exception LoginException
56      * @exception AuthenticationException
57      */

58     public void login() throws LoginException, AuthenticationException {
59         user = LoginManager.getInstance().authenticate(infoHandler);
60     }
61     
62     
63     /**
64      * This method returns the user session login object.
65      *
66      * @return The reference to the user session.
67      */

68     public UserSession getUser() {
69         return user;
70     }
71 }
72
Popular Tags