KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > webapps > authentication > AuthenticationManager


1 /*
2  * Copyright 1999-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 package org.apache.cocoon.webapps.authentication;
17
18 import java.io.IOException JavaDoc;
19
20 import org.apache.cocoon.ProcessingException;
21 import org.apache.cocoon.environment.Redirector;
22 import org.apache.cocoon.webapps.authentication.user.RequestState;
23 import org.apache.cocoon.webapps.authentication.user.UserHandler;
24 import org.apache.cocoon.webapps.session.context.SessionContext;
25 import org.apache.excalibur.source.SourceParameters;
26
27 /**
28  * This is the authentication manager.
29  * It is used to authenticate (login, logout) a user. Usually, this
30  * component should not be used from custom code. The provided
31  * actions perform all required tasks.
32  *
33  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
34  * @version CVS $Id: AuthenticationManager.java 53739 2004-10-04 19:19:19Z vgritsenko $
35 */

36 public interface AuthenticationManager {
37
38     /** The Avalon Role */
39     String JavaDoc ROLE = AuthenticationManager.class.getName();
40
41     /**
42      * Is the current user authenticated for the given handler?
43      * @return Returns the corresponding handler if the user is authenticated.
44      */

45     UserHandler isAuthenticated(String JavaDoc handlerName)
46     throws ProcessingException;
47
48     /**
49      * Is the current user authenticated for the given handler?
50      * If the user is already authenticated, the {@link RequestState}
51      * is updated to the provided information (handler and application).
52      */

53     boolean checkAuthentication(Redirector redirector,
54                                  String JavaDoc handlerName,
55                                  String JavaDoc applicationName)
56     throws ProcessingException, IOException JavaDoc;
57
58     /**
59      * Try to login the user.
60      * If the authentication is successful, the user handler is returned.
61      * If not, <code>null</code> is returned.
62      */

63     UserHandler login(String JavaDoc handlerName,
64                       String JavaDoc applicationName,
65                       SourceParameters parameters)
66     throws ProcessingException;
67
68     /**
69      * Perform a logout of the user.
70      */

71     void logout(String JavaDoc handlerName,
72                  int mode)
73     throws ProcessingException;
74
75     /**
76      * Get the current state of authentication
77      */

78     RequestState getState();
79
80     /**
81      * Create Application Context.
82      * This context is destroyed when the user logs out of the handler
83      */

84     SessionContext createApplicationContext(String JavaDoc name,
85                                             String JavaDoc loadURI,
86                                             String JavaDoc saveURI)
87     throws ProcessingException;
88 }
89
Popular Tags