"Authentication Framework with Flow" is now available as sample in your Cocoon installation at http://localhost:8888/samples/blocks/authentication-fw/flow/.

It is also possible to setup auth using actions, and access the authenticationcontext from flow. Thread http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=109533577114557&w=2 offers the solution.

In short:

var contextMan = cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE); 
var authContext = contextMan.getContext("authentication");
var userFrag = authContext.getXML("/authentication/ID");
var username = Packages.org.apache.cocoon.xml.dom.DOMUtil.getValueOfNode(userFrag);

The java equivalent code :

org.apache.avalon.framework.component.ComponentManager componentManager = CocoonComponentManager.getSitemapComponentManager();
SessionManager sessionManager = (SessionManager)componentManager.lookup(org.apache.cocoon.webapps.session.SessionManager.ROLE);
String username = sessionManager.getContextFragment( "authentication", "/authentication/ID").getFirstChild().getNodeValue();
  • No labels