KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > cocoon > acting > DelegatingAuthenticatorAction


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  */

17
18 /* $Id: DelegatingAuthenticatorAction.java 42616 2004-03-03 12:56:33Z gregor $ */
19
20 package org.apache.lenya.cms.cocoon.acting;
21
22 import java.util.Collections JavaDoc;
23 import java.util.Map JavaDoc;
24
25 import org.apache.avalon.framework.parameters.Parameters;
26 import org.apache.cocoon.environment.ObjectModelHelper;
27 import org.apache.cocoon.environment.Redirector;
28 import org.apache.cocoon.environment.Request;
29 import org.apache.cocoon.environment.SourceResolver;
30
31 /**
32  * Authenticator action that delegates the authentication to an access controller.
33  */

34 public class DelegatingAuthenticatorAction extends AccessControlAction {
35
36     /**
37      * @see org.apache.lenya.cms.cocoon.acting.AccessControlAction#doAct(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
38      */

39     protected Map JavaDoc doAct(
40         Redirector redirector,
41         SourceResolver resolver,
42         Map JavaDoc objectModel,
43         String JavaDoc source,
44         Parameters parameters)
45         throws Exception JavaDoc {
46
47         getLogger().debug("Authenticating request");
48
49         Request request = ObjectModelHelper.getRequest(objectModel);
50         Map JavaDoc result = null;
51         if (getAccessController().authenticate(request)) {
52             getLogger().debug("Authentication successful.");
53             result = Collections.EMPTY_MAP;
54         }
55         else {
56             getLogger().debug("Authentication failed.");
57         }
58         return result;
59     }
60
61 }
62
Popular Tags