Author: vgritsenko Date: Mon Oct 4 12:03:31 2004 New Revision: 53737 Modified: cocoon/trunk/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/LoginAction.java Log: enum -> keys
Modified: cocoon/trunk/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/LoginAction.java ============================================================================== --- cocoon/trunk/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/LoginAction.java (original) +++ cocoon/trunk/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/acting/LoginAction.java Mon Oct 4 12:03:31 2004 @@ -1,12 +1,12 @@ /* * Copyright 1999-2004 The Apache Software Foundation. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,11 +35,10 @@ * into the temporary context. * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: LoginAction.java,v 1.4 2004/03/05 13:01:40 bdelacretaz Exp $ + * @version CVS $Id$ */ -public final class LoginAction -extends ServiceableAction -implements ThreadSafe { +public final class LoginAction extends ServiceableAction + implements ThreadSafe { public Map act(Redirector redirector, SourceResolver resolver, @@ -47,30 +46,29 @@ String source, Parameters par) throws Exception { - if (this.getLogger().isDebugEnabled() ) { - this.getLogger().debug("BEGIN act resolver="+resolver+ - ", objectModel="+objectModel+ - ", source="+source+ - ", par="+par); + if (getLogger().isDebugEnabled()) { + getLogger().debug("BEGIN act resolver=" + resolver + + ", objectModel=" + objectModel + + ", source=" + source + + ", par=" + par); } final String handlerName = par.getParameter("handler", null); - if ( handlerName == null ) { + if (handlerName == null) { throw new ProcessingException("LoginAction requires at least the handler parameter."); } // build authentication parameters SourceParameters authenticationParameters = new SourceParameters(); - String[] enum = par.getNames(); - if (enum != null) { - for(int i = 0; i < enum.length; i++) { - final String key = enum[i]; - if ( key.startsWith("parameter_") ) { - authenticationParameters.setParameter( key.substring("parameter_".length()), - par.getParameter(key)); + String[] keys = par.getNames(); + if (keys != null) { + for (int i = 0; i < keys.length; i++) { + final String key = keys[i]; + if (key.startsWith("parameter_")) { + authenticationParameters.setParameter(key.substring("parameter_".length()), + par.getParameter(key)); } } - } Map map = null; @@ -79,23 +77,21 @@ AuthenticationManager authManager = null; try { authManager = (AuthenticationManager) this.manager.lookup(AuthenticationManager.ROLE); - UserHandler handler = authManager.login( handlerName, - par.getParameter("application", null), - authenticationParameters); - if ( handler != null) { + UserHandler handler = authManager.login(handlerName, + par.getParameter("application", null), + authenticationParameters); + if (handler != null) { // success map = handler.getContext().getContextInfo(); - } } finally { - this.manager.release( authManager); + this.manager.release(authManager); } - if (this.getLogger().isDebugEnabled() ) { - this.getLogger().debug("END act map="+map); + if (getLogger().isDebugEnabled()) { + getLogger().debug("END act map=" + map); } return map; } - }