KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > handler > LoginHandler


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow.handler;
19
20 import javax.security.auth.login.LoginException JavaDoc;
21 import java.security.Principal JavaDoc;
22
23
24 /**
25  * Handler for login/logout/roles.
26  */

27 public interface LoginHandler
28         extends Handler
29 {
30     /**
31      * Log in the given user.
32      *
33      * @param username the user to log in.
34      * @param password the user's password.
35      * @throws LoginException if the login fails.
36      */

37     public void login( FlowControllerHandlerContext context, String JavaDoc username, String JavaDoc password )
38         throws LoginException JavaDoc;
39     
40     /**
41      * Log out the current user.
42      *
43      * @param invalidateSessions if <code>true</code>, current sessions associated with the current
44      * logged-in user will be invalidated.
45      */

46     public void logout( FlowControllerHandlerContext context, boolean invalidateSessions );
47                         
48     
49     /**
50      * Tell whether the current user is in a given role.
51      *
52      * @param roleName the role to check.
53      * @return <code>true</code> if there is a current logged-in user who is in the given role.
54      */

55     public boolean isUserInRole( FlowControllerHandlerContext context, String JavaDoc roleName );
56     
57     /**
58      * Get the current user.
59      *
60      * @return a {@link Principal} that represents the current logged-in user, or <code>null</code> if there is no
61      * logged-in user.
62      */

63     public Principal JavaDoc getUserPrincipal( FlowControllerHandlerContext context );
64 }
65
Popular Tags