1 16 package org.apache.cocoon.webapps.authentication.acting; 17 18 import java.util.Map ; 19 20 import org.apache.avalon.framework.parameters.Parameters; 21 import org.apache.avalon.framework.thread.ThreadSafe; 22 import org.apache.cocoon.acting.ServiceableAction; 23 import org.apache.cocoon.environment.Redirector; 24 import org.apache.cocoon.environment.SourceResolver; 25 import org.apache.cocoon.webapps.authentication.AuthenticationManager; 26 import org.apache.cocoon.webapps.authentication.user.RequestState; 27 28 39 public final class AuthAction 40 extends ServiceableAction 41 implements ThreadSafe { 42 43 public Map act(Redirector redirector, 44 SourceResolver resolver, 45 Map objectModel, 46 String source, 47 Parameters par) 48 throws Exception { 49 if (this.getLogger().isDebugEnabled() ) { 50 this.getLogger().debug("BEGIN act resolver="+resolver+ 51 ", objectModel="+objectModel+ 52 ", source="+source+ 53 ", par="+par); 54 } 55 String handlerName = null; 56 String applicationName = null; 57 AuthenticationManager authManager = null; 58 Map map = null; 59 60 try { 61 handlerName = par.getParameter("handler", null); 62 applicationName = par.getParameter("application", null); 63 64 authManager = (AuthenticationManager) this.manager.lookup( AuthenticationManager.ROLE ); 65 66 if ( !authManager.checkAuthentication(redirector, handlerName, applicationName) ) { 68 } else { 71 RequestState state = authManager.getState(); 72 map = state.getHandler().getContext().getContextInfo(); 73 } 74 } finally { 75 this.manager.release( authManager ); 76 } 77 if (this.getLogger().isDebugEnabled() ) { 78 this.getLogger().debug("END act map="+map); 79 } 80 return map; 81 } 82 83 } 84 | Popular Tags |