KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > webapps > portal > acting > AuthAction


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.portal.acting;
17
18 import java.util.Map JavaDoc;
19 import org.apache.avalon.framework.parameters.Parameters;
20 import org.apache.avalon.framework.thread.ThreadSafe;
21 import org.apache.cocoon.acting.ServiceableAction;
22 import org.apache.cocoon.environment.Redirector;
23 import org.apache.cocoon.environment.SourceResolver;
24 import org.apache.cocoon.webapps.portal.components.PortalManager;
25
26 /**
27  * This is the authentication action for the portal
28  * This action protecteds a pipeline by using a coplet ID.
29  *
30  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
31  * @version CVS $Id: AuthAction.java 30932 2004-07-29 17:35:38Z vgritsenko $
32 */

33 public final class AuthAction
34 extends ServiceableAction
35 implements ThreadSafe {
36
37     public Map JavaDoc act(Redirector redirector,
38                    SourceResolver resolver,
39                    Map JavaDoc objectModel,
40                    String JavaDoc source,
41                    Parameters par)
42     throws Exception JavaDoc {
43         if (getLogger().isDebugEnabled()) {
44             getLogger().debug("BEGIN act resolver="+resolver+
45                               ", objectModel="+objectModel+
46                               ", source="+source+
47                               ", par="+par);
48         }
49         final String JavaDoc copletID = par.getParameter("coplet", null);
50
51         PortalManager portal = (PortalManager)this.manager.lookup( PortalManager.ROLE );
52         try {
53             portal.configurationTest();
54             if (null != copletID) {
55                 portal.checkAuthentication(redirector, copletID);
56             }
57         } finally {
58             this.manager.release( portal );
59         }
60
61         if (this.getLogger().isDebugEnabled()) {
62             this.getLogger().debug("END act map={}");
63         }
64         return EMPTY_MAP;
65     }
66
67 }
68
Popular Tags