You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2006/06/16 18:03:15 UTC

svn commit: r414854 [2/2] - in /cocoon/trunk: blocks/ blocks/cocoon-auth/ blocks/cocoon-auth/cocoon-auth-impl/ blocks/cocoon-auth/cocoon-auth-impl/src/ blocks/cocoon-auth/cocoon-auth-impl/src/main/ blocks/cocoon-auth/cocoon-auth-impl/src/main/java/ blo...

Added: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSecurityHandler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSecurityHandler.java?rev=414854&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSecurityHandler.java (added)
+++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSecurityHandler.java Fri Jun 16 09:03:13 2006
@@ -0,0 +1,107 @@
+/* 
+ * Copyright 2006 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.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.auth.impl;
+
+import java.security.Principal;
+import java.util.Map;
+
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.auth.AbstractSecurityHandler;
+import org.apache.cocoon.auth.StandardUser;
+import org.apache.cocoon.auth.User;
+
+/**
+ * Verify if a user can be authenticated.
+ * This is a very simple authenticator that checks if the user is authenticated
+ * using the servlet authentication mechanisms.
+ *
+ * @version $Id$
+*/
+public class ServletSecurityHandler
+    extends AbstractSecurityHandler {
+
+    /** The component context. */
+    protected Context context;
+
+    /**
+     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     */
+    public void contextualize(final Context aContext) throws ContextException {
+        super.contextualize(aContext);
+        this.context = aContext;
+    }
+
+    /**
+     * Create a new user.
+     * @param req The current request.
+     * @return A new user object.
+     */
+    protected User createUser(final Request req) {
+        final User user = new ServletUser(req);
+        return user;
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.SecurityHandler#login(java.util.Map)
+     */
+    public User login(final Map loginContext) throws Exception {
+        final Request req = ContextHelper.getRequest(this.context);
+        User user = null;
+        if ( req.getRemoteUser() != null ) {
+            user = this.createUser( req );
+        }
+        return user;
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.SecurityHandler#logout(java.util.Map, org.apache.cocoon.auth.User)
+     */
+    public void logout(final Map logoutContext, final User user) {
+        // TODO what can we do here?
+    }
+
+    /**
+     * Inner class for the current user. This class provides access to some
+     * servlet specific information.
+     */
+    public static class ServletUser extends StandardUser {
+
+        /** The principal belonging to the user. */
+        protected final Principal principal;
+
+        /**
+         * Instantiate a new user.
+         * @param req      The current request.
+         */
+        public ServletUser(final Request req) {
+            super(req.getRemoteUser());
+            this.principal = req.getUserPrincipal();
+            this.setAttribute(User.ATTRIBUTE_PRINCIPAL, this.principal);
+        }
+
+        /**
+         * Return the current principal.
+         * @return The principal.
+         */
+        public Principal getPrincipal() {
+            return this.principal;
+        }
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSecurityHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSecurityHandler.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSessionListener.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSessionListener.java?rev=414854&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSessionListener.java (added)
+++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSessionListener.java Fri Jun 16 09:03:13 2006
@@ -0,0 +1,47 @@
+/* 
+ * Copyright 2006 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.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.auth.impl;
+
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+/**
+ * This session listener keeps track of expired sessions. It can be used in
+ * conjunction with the {@link org.apache.cocoon.auth.impl.StandardApplicationManager}
+ *
+ * This listener has not been tested yet.
+ *
+ * @version $Id$
+ */
+public class ServletSessionListener implements HttpSessionListener {
+
+    /**
+     * @see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent)
+     */
+    public void sessionCreated(final HttpSessionEvent event) {
+        // we don't care about a new session
+    }
+
+    /**
+     * @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
+     */
+    public void sessionDestroyed(final HttpSessionEvent event) {
+        final HttpSession session = event.getSession();
+        StandardApplicationManager.logoutFromAllApplications(session);
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSessionListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ServletSessionListener.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java?rev=414854&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java (added)
+++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java Fri Jun 16 09:03:13 2006
@@ -0,0 +1,334 @@
+/* 
+ * Copyright 2006 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.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.auth.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpSession;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Session;
+import org.apache.cocoon.servlet.CocoonServlet;
+import org.apache.commons.lang.ObjectUtils;
+import org.apache.cocoon.auth.Application;
+import org.apache.cocoon.auth.ApplicationManager;
+import org.apache.cocoon.auth.ApplicationUtil;
+import org.apache.cocoon.auth.SecurityHandler;
+import org.apache.cocoon.auth.User;
+
+/**
+ * This is the default implementation of the
+ * {@link org.apache.cocoon.auth.ApplicationManager}.
+ *
+ * @version $Id$
+*/
+public class StandardApplicationManager
+    extends AbstractLogEnabled
+    implements ApplicationManager,
+               Contextualizable,
+               Serviceable,
+               ThreadSafe,
+               Disposable {
+
+    /** The key used to store the login information in the session. */
+    protected static final String LOGIN_INFO_KEY =
+                     StandardApplicationManager.class.getName() + "/logininfo";
+
+    /** The prefix used to store the application data object in the session. */
+    protected static final String APPLICATION_KEY_PREFIX =
+                     StandardApplicationManager.class.getName() + "/app:";
+
+    /** The component context. */
+    protected Context context;
+
+    /** The service manager. */
+    protected ServiceManager manager;
+
+    /**
+     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     */
+    public void contextualize(final Context aContext) throws ContextException {
+        this.context = aContext;
+        try {
+            ServletConfig config =
+                (ServletConfig)this.context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG);
+            config.getServletContext().setAttribute(StandardApplicationManager.class.getName(),
+                                                    this);
+        } catch (ContextException ignore) {
+            // we ignore this if we are not running inside a servlet environment
+        }
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(final ServiceManager aManager) throws ServiceException {
+        this.manager = aManager;
+    }
+
+    /**
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        this.manager = null;
+    }
+
+    /**
+     * Get the application with the given name. This method tries to lookup the
+     * applicating using the current sitemap service manager.
+     * @param appName The name of the application.
+     * @return The application object.
+     * @throws Exception If the application can't be found.
+     */
+    protected Application getApplication(final String appName)
+    throws Exception {
+        final ServiceManager current = (ServiceManager)
+                   this.context.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
+        Object o = current.lookup(Application.class.getName() + '/' + appName);
+        if ( o == null ) {
+            throw new ConfigurationException(
+                           "Application '" + appName + "' not found."
+                       );
+        }
+        // to avoid messy release stuff later on, we just release the app now
+        // as an application is thread safe this isn't really a problem
+        current.release(o);
+        return (Application)o;
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.ApplicationManager#isLoggedIn(java.lang.String)
+     */
+    public boolean isLoggedIn(final String appName) {
+        Object appData = null;
+        final Map objectModel = ContextHelper.getObjectModel( this.context );
+        final Request req = ObjectModelHelper.getRequest(objectModel);
+        final Session session = req.getSession(false);
+        if ( session != null ) {
+            appData = session.getAttribute(APPLICATION_KEY_PREFIX + appName);
+
+            // if the user is logged in, we set the current application, data and user
+            if ( appData != null ) {
+                try {
+                    final Application application = this.getApplication(appName);
+                    final User user = (User)session.getAttribute(USER + '-' + appName);
+                    final Application oldApp = (Application)objectModel.get(ApplicationManager.APPLICATION);
+                    objectModel.put(ApplicationManager.APPLICATION, application);
+                    objectModel.put(ApplicationManager.APPLICATION_DATA, appData);
+                    objectModel.put(ApplicationManager.USER, user);
+                    // notify application
+                    // The application is only notified once per request.
+                    if ( oldApp == null || oldApp != application ) {
+                        application.userIsAccessing(user);
+                    }
+                } catch (Exception ignore) {
+                    throw new CascadingRuntimeException("Unable to get application '"
+                                                        + appName + "'", ignore);
+                }
+            }
+        }
+
+        return (appData != null);
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.ApplicationManager#login(java.lang.String, java.util.Map)
+     */
+    public User login(final String appName, final Map loginContext) throws Exception {
+        User user = null;
+
+        final Map objectModel = ContextHelper.getObjectModel( this.context );
+
+        // first check, if we are already logged in
+        if ( this.isLoggedIn(appName) ) {
+            user = ApplicationUtil.getUser(objectModel);
+        } else {
+            final Request req = ObjectModelHelper.getRequest(objectModel);
+            Session session = req.getSession(false);
+
+            final Application app = this.getApplication(appName);
+            LoginInfo info = null;
+            Map loginInfos = null;
+
+            if ( session != null ) {
+                // is the user already logged in on the security handler?
+                loginInfos = (Map)session.getAttribute(LOGIN_INFO_KEY);
+                if ( loginInfos != null
+                      && loginInfos.containsKey(app.getSecurityHandler()) ) {
+                    info = (LoginInfo)loginInfos.get(app.getSecurityHandler());
+                    user = info.user;
+                }
+            }
+            if ( user == null ) {
+                user = app.getSecurityHandler().login(loginContext);
+                if ( user != null ) {
+                    // create new login info
+                    session = req.getSession();
+                    loginInfos = (Map)session.getAttribute(LOGIN_INFO_KEY);
+                    if ( loginInfos == null ) {
+                        loginInfos = new HashMap();
+                    }
+                    info = new LoginInfo(user);
+                    loginInfos.put(app.getSecurityHandler().getId(), info);
+                }
+            }
+
+            // user can be null, if login failed
+            if ( user != null ) {
+                info.incUsageCounter(appName);
+                session.setAttribute(LOGIN_INFO_KEY, loginInfos);
+
+                // set the user in the session
+                session.setAttribute(USER + '-' + appName, user);
+                objectModel.put(ApplicationManager.USER, user);
+
+                // set the application in the object model
+                objectModel.put(ApplicationManager.APPLICATION, app);
+
+                // notify the application
+                app.userDidLogin(user, loginContext);
+
+                // set the application data in the session
+                Object data = ObjectUtils.NULL;
+                if ( app.getApplicationStore() != null ) {
+                    data = app.getApplicationStore().loadApplicationData(user, app);
+                }
+                session.setAttribute(APPLICATION_KEY_PREFIX + appName, data);
+                objectModel.put(ApplicationManager.APPLICATION_DATA, data);
+                // notify application
+                app.userIsAccessing(user);
+            }
+        }
+
+        return user;
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.ApplicationManager#logout(java.lang.String, java.util.Map)
+     */
+    public void logout(final String appName, final Map logoutContext) {
+        final Map objectModel = ContextHelper.getObjectModel( this.context );
+        final Request req = ObjectModelHelper.getRequest(objectModel);
+        final Session session = req.getSession(false);
+        if ( session != null ) {
+            Application app;
+
+            try {
+                app = this.getApplication(appName);
+            } catch (Exception ignore) {
+                throw new CascadingRuntimeException("Unable to get application '"
+                                                    + appName + "'", ignore);
+            }
+
+            // remove application data from session
+            session.removeAttribute(APPLICATION_KEY_PREFIX + appName);
+
+            // remove application from object model
+            if ( app.equals( ApplicationUtil.getApplication(objectModel) ) ) {
+                objectModel.remove(ApplicationManager.APPLICATION);
+                objectModel.remove(ApplicationManager.APPLICATION_DATA);
+                objectModel.remove(ApplicationManager.USER);
+            }
+
+            // remove user
+            session.removeAttribute(USER + '-' + appName);
+
+            // decrement logininfo counter
+            final Map loginInfos = (Map)session.getAttribute(LOGIN_INFO_KEY);
+            if ( loginInfos != null ) {
+                final LoginInfo info = (LoginInfo)loginInfos.get(app.getSecurityHandler().getId());
+                if ( info != null ) {
+                    // notify the application
+                    app.userWillLogout(info.user, logoutContext);
+
+                    info.decUsageCounter(appName);
+                    if ( info.isUsed() ) {
+                        session.setAttribute(LOGIN_INFO_KEY, loginInfos);
+                    } else {
+                        // logout from security handler
+                        app.getSecurityHandler().logout(logoutContext, info.user);
+                        // remove user info
+                        loginInfos.remove(app.getSecurityHandler().getId());
+                        if ( loginInfos.size() > 0 ) {
+                            session.setAttribute(LOGIN_INFO_KEY, loginInfos);
+                        } else {
+                            session.removeAttribute(LOGIN_INFO_KEY);
+                            // the user has left all applications, test the mode:
+                            String mode = null;
+                            if ( logoutContext != null ) {
+                                mode = (String)logoutContext.get(LOGOUT_CONTEXT_MODE_KEY);
+                            }
+                            if ( mode == null
+                                 || mode.equals(LOGOUT_MODE_TERMINATE_SESSION_IF_UNUSED) ) {
+                                session.invalidate();
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Logs the user out of all applications.
+     * This method has not been tested yet.
+     * @param session The corresponding session
+     */
+    public static void logoutFromAllApplications(final HttpSession session) {
+        final Map loginInfos = (Map)session.getAttribute(LOGIN_INFO_KEY);
+        if ( loginInfos != null ) {
+            final StandardApplicationManager appManager =
+                  (StandardApplicationManager)session.getServletContext()
+                                  .getAttribute(StandardApplicationManager.class.getName());
+            final Iterator i = loginInfos.values().iterator();
+            while ( i.hasNext() ) {
+                final LoginInfo info = (LoginInfo)i.next();
+                if ( info.isUsed() ) {
+                    final Iterator appIter = info.getApplications().iterator();
+                    SecurityHandler handler = null;
+                    while ( appIter.hasNext() ) {
+                        final String appName = (String)appIter.next();
+                        try {
+                            final Application app = appManager.getApplication(appName);
+                            app.userWillLogout(info.getUser(), null);
+                            handler = app.getSecurityHandler();
+                        } catch (Exception ignore) {
+                            // we ignore this
+                        }
+                    }
+                    handler.logout(null, info.getUser());
+                }
+            }
+        }
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/PortalApplication.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/PortalApplication.java?rev=414854&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/PortalApplication.java (added)
+++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/PortalApplication.java Fri Jun 16 09:03:13 2006
@@ -0,0 +1,37 @@
+/* 
+ * Copyright 2006 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.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.auth.portal;
+
+import java.util.Map;
+
+import org.apache.cocoon.auth.Application;
+
+/**
+ * The current portal application.
+ *
+ * @version $Id$
+*/
+public interface PortalApplication
+    extends Application {
+
+    /**
+     * Return the configuration for the portal.
+     * @return A map containing the different configuration values as defined
+     *         by the profile manager.
+     */
+    Map getPortalConfiguration();
+}

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/PortalApplication.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/PortalApplication.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java?rev=414854&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java (added)
+++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java Fri Jun 16 09:03:13 2006
@@ -0,0 +1,183 @@
+/* 
+ * Copyright 2006 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.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.auth.portal;
+
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.user.UserEventUtil;
+import org.apache.cocoon.portal.profile.PortalUser;
+import org.apache.cocoon.portal.profile.impl.AbstractPortalUser;
+import org.apache.cocoon.auth.StandardApplication;
+import org.apache.cocoon.auth.User;
+
+/**
+ * This is a default implementation for a portal application.
+ *
+ * @version $Id$
+*/
+public class StandardPortalApplication
+    extends StandardApplication
+    implements PortalApplication {
+
+    /** Attribute storing the portal user. */
+    public static final String PORTAL_USER = PortalUser.class.getName();
+
+    /** The configuration. */
+    protected Map portalConfig;
+
+    /** The portal service. */
+    protected PortalService portalService;
+
+    /**
+     * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void configure(final Configuration conf) throws ConfigurationException {
+        super.configure(conf);
+        final Configuration config = conf.getChild("profiles");
+        final Configuration[] children = config.getChildren();
+        this.portalConfig = new HashMap();
+        if ( children != null ) {
+            for(int i=0; i < children.length; i++) {
+                this.portalConfig.put(children[i].getName(), children[i].getAttribute("uri"));
+            }
+        }
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.StandardApplication#dispose()
+     */
+    public void dispose() {
+        if ( this.manager != null ) {
+            this.manager.release(this.portalService);
+            this.portalService = null;
+        }
+        super.dispose();
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.StandardApplication#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager aManager) throws ServiceException {
+        super.service(aManager);
+        this.portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.portal.PortalApplication#getPortalConfiguration()
+     */
+    public Map getPortalConfiguration() {
+        return this.portalConfig;
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.Application#userDidLogin(org.apache.cocoon.auth.User, java.util.Map)
+     */
+    public void userDidLogin(final User user, final Map context) {
+        super.userDidLogin(user, context);
+        final PortalUser pu = new PortalUserInfo(user);
+        user.setAttribute(PORTAL_USER, pu);
+        UserEventUtil.sendUserDidLoginEvent(this.portalService, pu);
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.Application#userWillLogout(org.apache.cocoon.auth.User, java.util.Map)
+     */
+    public void userWillLogout(final User user, final Map context) {
+        UserEventUtil.sendUserWillLogoutEvent(this.portalService, (PortalUser)user.getAttribute(PORTAL_USER));
+        super.userWillLogout(user, context);
+    }
+
+    /**
+     * @see org.apache.cocoon.auth.Application#userIsAccessing(org.apache.cocoon.auth.User)
+     */
+    public void userIsAccessing(User user) {
+        UserEventUtil.sendUserIsAccessingEvent(this.portalService, (PortalUser)user.getAttribute(PORTAL_USER));
+        super.userIsAccessing(user);
+    }
+
+    /**
+     * The user info for the portal engine.
+     */
+    public static final class PortalUserInfo extends AbstractPortalUser {
+
+        /** The cauth user object. */
+        protected final User user;
+
+        /**
+         * Create a new user info object.
+         * @param aUser      The cauth user object.
+         */
+        public PortalUserInfo(final User aUser) {
+            this.user = aUser;
+            this.setAnonymous(this.user.getId().equals("anonymous"));
+            // build a map for the user info
+            final Map userInfos = new HashMap();
+            final Iterator i = this.user.getAttributeNames();
+            while ( i.hasNext() ) {
+                final String key = (String)i.next();
+                final Object value = this.user.getAttribute(key);
+                userInfos.put(key, value);
+            }
+            if ( userInfos.size() > 0 ) {
+                this.setUserInfos(userInfos);
+            }
+        }
+
+        /**
+         * @see org.apache.cocoon.portal.profile.PortalUser#isUserInRole(java.lang.String)
+         */
+        public boolean isUserInRole(final String role) {
+            return user.isUserInRole(role);
+        }
+
+        /**
+         * @see org.apache.cocoon.portal.profile.PortalUser#getGroup()
+         */
+        public String getGroup() {
+            return (String)this.user.getAttribute("group");
+        }
+
+        /**
+         * @see org.apache.cocoon.portal.profile.PortalUser#getUserName()
+         */
+        public String getUserName() {
+            return this.user.getId();
+        }
+
+        /**
+         * @see org.apache.cocoon.portal.profile.impl.AbstractPortalUser#getAuthType()
+         */
+        public String getAuthType() {
+            return "cauth";
+        }
+
+        /**
+         * @see org.apache.cocoon.portal.profile.impl.AbstractPortalUser#getUserPrincipal()
+         */
+        public Principal getUserPrincipal() {
+            return (Principal) this.user.getAttribute(User.ATTRIBUTE_PRINCIPAL);
+        }
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/portal/StandardPortalApplication.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/roles.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/roles.xconf?rev=414854&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/roles.xconf (added)
+++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/roles.xconf Fri Jun 16 09:03:13 2006
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!-- 
+  Copyright 2006 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.
+
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<role-list>
+
+  <!--+ 
+      | Application Manager
+      |
+      +-->
+    <role name="org.apache.cocoon.auth.ApplicationManager"
+          default-class="org.apache.cocoon.auth.impl.StandardApplicationManager"/>
+
+</role-list>
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/roles.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/roles.xconf
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/sitemap-addons.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/sitemap-addons.xconf?rev=414854&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/sitemap-addons.xconf (added)
+++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/sitemap-addons.xconf Fri Jun 16 09:03:13 2006
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2006 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.
+
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<map:components xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:actions>
+    <map:action name="cauth-is-logged-in"
+                src="org.apache.cocoon.auth.acting.LoggedInAction"/>
+    <map:action name="cauth-login"
+                src="org.apache.cocoon.auth.acting.LoginAction"/>
+    <map:action name="cauth-logout"
+                src="org.apache.cocoon.auth.acting.LogoutAction"/>
+  </map:actions>
+</map:components>

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/sitemap-addons.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/resources/org/apache/cocoon/auth/sitemap-addons.xconf
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-auth/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/pom.xml?rev=414854&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-auth/pom.xml (added)
+++ cocoon/trunk/blocks/cocoon-auth/pom.xml Fri Jun 16 09:03:13 2006
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 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.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!--+
+    | @version $Id$
+    |
+    +-->
+<project>
+  <parent>
+    <groupId>org.apache.cocoon</groupId>
+    <artifactId>cocoon-blocks-modules</artifactId>
+    <version>1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.cocoon</groupId>
+  <artifactId>cocoon-auth</artifactId>
+  <packaging>pom</packaging>
+  <name>Cocoon Authentication Framework</name>
+  <version>1-SNAPSHOT</version>
+  <modules>
+    <module>cocoon-auth-impl</module>
+  </modules>
+</project>

Propchange: cocoon/trunk/blocks/cocoon-auth/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-auth/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/pom.xml?rev=414854&r1=414853&r2=414854&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/pom.xml Fri Jun 16 09:03:13 2006
@@ -51,9 +51,9 @@
       <version>1.0.0-SNAPSHOT</version>
     </dependency>
     <dependency>
-      <groupId>cowarp</groupId>
-      <artifactId>cowarp</artifactId>
-      <version>0.5-dev-20051002</version>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-auth-impl</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/security/DBSecurityHandler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/security/DBSecurityHandler.java?rev=414854&r1=414853&r2=414854&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/security/DBSecurityHandler.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/security/DBSecurityHandler.java Fri Jun 16 09:03:13 2006
@@ -19,14 +19,15 @@
 import java.util.Map;
 
 import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.auth.AbstractSecurityHandler;
+import org.apache.cocoon.auth.ApplicationManager;
+import org.apache.cocoon.auth.SecurityHandler;
 import org.apache.cocoon.ojb.samples.bean.User;
 import org.apache.ojb.broker.PersistenceBroker;
 import org.apache.ojb.broker.PersistenceBrokerFactory;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.Query;
 import org.apache.ojb.broker.query.QueryByCriteria;
-import org.osoco.cowarp.AbstractSecurityHandler;
-import org.osoco.cowarp.ApplicationManager;
 
 /**
  * @version $Id$
@@ -35,9 +36,9 @@
     extends AbstractSecurityHandler {
 
     /**
-     * @see org.osoco.cowarp.SecurityHandler#login(Map)
+     * @see SecurityHandler#login(Map)
      */
-    public org.osoco.cowarp.User login(Map loginContext) throws Exception {
+    public org.apache.cocoon.auth.User login(Map loginContext) throws Exception {
         PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
 
         try {
@@ -69,9 +70,9 @@
     }
 
     /**
-     * @see org.osoco.cowarp.SecurityHandler#logout(Map, org.osoco.cowarp.User)
+     * @see SecurityHandler#logout(Map, org.apache.cocoon.auth.User)
      */
-    public void logout(Map context, org.osoco.cowarp.User user) {
+    public void logout(Map context, org.apache.cocoon.auth.User user) {
         // nothing to do
     }
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/security/PortalUser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/security/PortalUser.java?rev=414854&r1=414853&r2=414854&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/security/PortalUser.java (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/java/org/apache/cocoon/portal/security/PortalUser.java Fri Jun 16 09:03:13 2006
@@ -17,7 +17,7 @@
 
 import java.util.ArrayList;
 
-import org.osoco.cowarp.StandardUser;
+import org.apache.cocoon.auth.StandardUser;
 
 /**
  * @version $Id$

Copied: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/auth-cauth.xconf (from r414310, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/auth-cowarp.xconf)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/auth-cauth.xconf?p2=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/auth-cauth.xconf&p1=cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/auth-cowarp.xconf&r1=414310&r2=414854&rev=414854&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/auth-cowarp.xconf (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/auth-cauth.xconf Fri Jun 16 09:03:13 2006
@@ -15,25 +15,25 @@
   limitations under the License.
 -->
 <!--+
-    | This is the configuration for using CoWarp for authentication.
+    | This is the configuration for using CAuth for authentication.
     |
-    | SVN $Id$
+    | @version $Id$
     +-->
 <components>
-  <!-- Include CoWarp components. -->
-  <include src="resource://org/osoco/cowarp/roles.xconf"/>
+  <!-- Include CAuth components. -->
+  <include src="resource://org/apache/cocoon/auth/roles.xconf"/>
 
   <!-- This security handler uses OJB and the hsqldb for the authentication: -->
-  <component role="org.osoco.cowarp.SecurityHandler/portal" 
+  <component role="org.apache.cocoon.auth.SecurityHandler/portal" 
              class="org.apache.cocoon.portal.security.DBSecurityHandler"/>
   <!-- If you want to use a pipeline for the authentication use this configuration:
-    <component role="org.osoco.cowarp.SecurityHandler/portal" 
-               class="org.osoco.cowarp.impl.PipelineSecurityHandler">
+    <component role="org.apache.cocoon.auth.SecurityHandler/portal" 
+               class="org.apache.cocoon.auth.impl.PipelineSecurityHandler">
       <authentication-resource>cocoon:raw:/sunrise-authuser</authentication-resource>
     </component>
   -->
-  <component role="org.osoco.cowarp.Application/portal" 
-             class="org.osoco.cowarp.portal.StandardPortalApplication" 
+  <component role="org.apache.cocoon.auth.Application/portal" 
+             class="org.apache.cocoon.auth.portal.StandardPortalApplication" 
              security-handler="portal"/>
 
 </components>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/cocoon-portal-sample.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/cocoon-portal-sample.xconf?rev=414854&r1=414853&r2=414854&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/cocoon-portal-sample.xconf (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/conf/cocoon-portal-sample.xconf Fri Jun 16 09:03:13 2006
@@ -38,13 +38,9 @@
   <!-- If you don't need WSRP support, you can remove the following include: -->
   <include src="resource://org/apache/cocoon/portal/wsrp/portal-wsrp.roles"/>
 
-  <!-- We use CoWarp for authentication. If you don't use CoWarp remove this line: -->
-  <include src="auth-cowarp.xconf"/>
+  <!-- We use CAuth for authentication. If you don't use CAuth remove this line: -->
+  <include src="auth-cauth.xconf"/>
   
-  <!-- If you want to use the authentication-fw uncomment this line: 
-  <include src="auth-authfw.xconf"/>
-  -->
-
   <!-- We use Castor for persisting/mapping the profiles to XML: -->
   <include src="resource://org/apache/cocoon/portal/persistence/castor/portal-castor.roles"/>
 

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/coplets/basket/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/coplets/basket/sitemap.xmap?rev=414854&r1=414853&r2=414854&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/coplets/basket/sitemap.xmap (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/coplets/basket/sitemap.xmap Fri Jun 16 09:03:13 2006
@@ -217,7 +217,7 @@
           <map:parameter name="handler" value="portal-handler"/>
           <map:parameter name="application" value="portal"/>
          -->
-        <map:act type="cowarp-is-logged-in">
+        <map:act type="cauth-is-logged-in">
           <map:parameter name="application" value="portal"/>
  
           <map:select type="resource-exists">

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap?rev=414854&r1=414853&r2=414854&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/sitemap.xmap Fri Jun 16 09:03:13 2006
@@ -23,8 +23,8 @@
     <map:include src="conf/cocoon-portal-sample.xconf"/>
     <map:include src="conf/cocoon-portal-tools.xconf"/>
 
-    <!-- Load Sitemap components provided by CoWarp. -->
-    <map:include src="resource://org/osoco/cowarp/sitemap-addons.xconf"/>
+    <!-- Load Sitemap components provided by CAuth. -->
+    <map:include src="resource://org/apache/cocoon/auth/sitemap-addons.xconf"/>
 
     <map:generators default="file">
       <map:generator name="portal" src="org.apache.cocoon.portal.generation.PortalGenerator"/>
@@ -190,11 +190,11 @@
       </map:match>
 
       <!-- Do an auto login as anonymous -->
-      <map:act type="cowarp-is-logged-in">
+      <map:act type="cauth-is-logged-in">
         <map:parameter name="application" value="portal"/>
         <map:parameter name="negate-result" value="true"/>
 
-        <map:act type="cowarp-login">
+        <map:act type="cauth-login">
           <map:parameter name="application" value="portal"/>
 
           <map:parameter name="name" value="anonymous"/>
@@ -204,7 +204,7 @@
 
       <!-- Test pipeline for portal engine -->
       <map:match pattern="portal">
-        <map:act type="cowarp-is-logged-in">
+        <map:act type="cauth-is-logged-in">
           <map:parameter name="application" value="portal"/>
 
           <map:generate type="portal" label="content"/>
@@ -239,7 +239,7 @@
 
       <!-- Test pipeline for bookmark -->
       <map:match pattern="bookmark">
-        <map:act type="cowarp-is-logged-in">
+        <map:act type="cauth-is-logged-in">
           <map:parameter name="application" value="portal"/>
 
           <map:act type="portal-bookmark">
@@ -249,7 +249,7 @@
       </map:match>
 
       <map:match pattern="portalxml">
-        <map:act type="cowarp-is-logged-in">
+        <map:act type="cauth-is-logged-in">
           <map:parameter name="application" value="portal"/>
 
             <map:generate type="portal" label="content"/>
@@ -258,7 +258,7 @@
       </map:match>
 
       <map:match pattern="layoutxml-*">
-        <map:act type="cowarp-is-logged-in">
+        <map:act type="cauth-is-logged-in">
           <map:parameter name="application" value="portal"/>
 
           <map:generate src="layout://{../1}"/>
@@ -276,13 +276,13 @@
         - if we are anonymous, then logout
         - if we are any other use, redirect to loggedin
         -->
-          <map:act type="cowarp-is-logged-in">
+          <map:act type="cauth-is-logged-in">
             <map:parameter name="application" value="portal"/>
 
             <map:select type="parameter" >
               <map:parameter name="parameter-selector-test" value="{ID}"/>
               <map:when test="anonymous">
-                <map:act type="cowarp-logout">
+                <map:act type="cauth-logout">
                   <map:parameter name="application" value="portal"/>
                 </map:act>
               </map:when>
@@ -293,7 +293,7 @@
           </map:act>
 
         <!-- Start the authentication process -->
-        <map:act type="cowarp-login">
+        <map:act type="cauth-login">
           <map:parameter name="application" value="portal"/>
           <map:parameter name="name" value="{request-param:name}"/>
           <map:parameter name="password" value="{request-param:password}"/>
@@ -312,7 +312,7 @@
       </map:match>
 
       <map:match pattern="loggedin">
-        <map:act type="cowarp-is-logged-in">
+        <map:act type="cauth-is-logged-in">
           <map:parameter name="application" value="portal"/>
 
           <map:generate src="resources/logged-in.xml"/>
@@ -324,12 +324,12 @@
       </map:match>
 
       <map:match pattern="logout">
-        <map:act type="cowarp-is-logged-in">
+        <map:act type="cauth-is-logged-in">
           <map:parameter name="application" value="portal"/>
 <!--
             <map:act type="portal-save-profile"/>
 -->
-          <map:act type="cowarp-logout">
+          <map:act type="cauth-logout">
 		    <map:parameter name="application" value="portal"/>
 	      </map:act>
         </map:act>
@@ -341,7 +341,7 @@
 	
 	<!-- mount sitemap of the portal tools -->
 	<map:match pattern="tools/**"> 
-		<map:act type="cowarp-is-logged-in">
+		<map:act type="cauth-is-logged-in">
 			<map:parameter name="application" value="portal"/> 
 			
 			<map:mount uri-prefix="tools" src="tools/sitemap.xmap"/>

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/tools/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/tools/sitemap.xmap?rev=414854&r1=414853&r2=414854&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/tools/sitemap.xmap (original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-sample/src/main/resources/COB-INF/tools/sitemap.xmap Fri Jun 16 09:03:13 2006
@@ -102,7 +102,7 @@
 
       <!-- mount sub-sitemaps -->
       <map:match pattern="plugins/*/**">
-     	 <map:act type="cowarp-is-logged-in">
+     	 <map:act type="cauth-is-logged-in">
             <map:parameter name="application" value="portal"/> 
 	      	<map:act type="check-access-action">
 	    		<map:parameter name="url" value="{../1}/{../2}"/>

Modified: cocoon/trunk/blocks/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/pom.xml?rev=414854&r1=414853&r2=414854&view=diff
==============================================================================
--- cocoon/trunk/blocks/pom.xml (original)
+++ cocoon/trunk/blocks/pom.xml Fri Jun 16 09:03:13 2006
@@ -21,11 +21,11 @@
   xmlns="http://maven.apache.org/POM/4.0.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  
+
   <modelVersion>4.0.0</modelVersion>  
-  
+
   <packaging>pom</packaging>  
-  
+
   <parent>
     <groupId>org.apache.cocoon</groupId>
     <artifactId>cocoon</artifactId>
@@ -34,13 +34,14 @@
 
   <groupId>org.apache.cocoon</groupId>
   <artifactId>cocoon-blocks-modules</artifactId>
-    
+
   <name>Cocoon Blocks [modules]</name>
 
   <modules>
         <module>cocoon-ajax</module>
 		<module>cocoon-apples</module>
 		<module>cocoon-asciiart</module>
+		<module>cocoon-auth</module>
 		<module>cocoon-authentication-fw</module>
 		<module>cocoon-axis</module>
 		<module>cocoon-batik</module>

Modified: cocoon/trunk/commons/CREDITS.txt
URL: http://svn.apache.org/viewvc/cocoon/trunk/commons/CREDITS.txt?rev=414854&r1=414853&r2=414854&view=diff
==============================================================================
--- cocoon/trunk/commons/CREDITS.txt (original)
+++ cocoon/trunk/commons/CREDITS.txt Fri Jun 16 09:03:13 2006
@@ -44,6 +44,9 @@
 evolved from the Woody donation made by Outerthought
 (http://outerthought.org).
 
+The initial code of the official Cocoon authentication block (CAuth)
+evolved from the CoWarp donation made by Carsten Ziegeler (cziegeler@osoco.org).
+
 
  Credits of included software
  ----------------------------