cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nele Vogel" ...@sevencs.com>
Subject authentication framework
Date Wed, 10 Mar 2004 13:06:57 GMT
Hi everybody!

I am trying to adapt the authentication framework I found in the 'samples'
folder of Cocoon 2.1.2.

When I call the pipelines explicitly, I am able to log in and out of the
authentication framework without any troubles.
http://localhost:8080/cocoon/home/content/protected/folder1/subfolder1/login
http://localhost:8080/cocoon/home/content/protected/folder1/subfolder1/protected
http://localhost:8080/cocoon/home/content/protected/folder1/subfolder1/do-logout

However, the authentication process *fails*, when I use targets that reside in
superordinate sitemaps.
http://localhost:8080/cocoon/home/folder1/subfolder1/login.protected
http://localhost:8080/cocoon/home/folder1/subfolder1/protected.protected
http://localhost:8080/cocoon/home/folder1/subfolder1/do-logout.protected

Is it possible to initiate the authentication process using superordinate
sitemaps OR do all targets have to be located in one and only one sitemap?

I am at a complete loss at this problem!
Thank you for your help!

Nele

---
Below you find configuration details and sitemap snippets.

<!-- ============================================== -->
<!-- Configuration -->
<!-- ============================================== -->
SuSE Linux 8.2
Apache Tomcat 4.1.27
Cocoon 2.1.2

<!-- ============================================== -->
<!-- directory structure (partial depiction) -->
<!-- ============================================== -->
home/
+-sitemap.xmap
--content/
  +-sitemap.xmap
  --protected/
    +-sitemap.xmap
    --folder1/
      +-sitemap.xmap
      --subfolder1/
        +-sitemap.xmap
        +-protected-file1.xml
        +-protected-file2.xml
        +-protected-file3.xml
      --subfolder2/sitemap.xmap
        +-sitemap.xmap
        +-protected-file1.xml
        +-protected-file2.xml
        +-protected-file3.xml


<!-- ============================================== -->
<!-- SITEMAP SNIPPETS -->
<!-- ============================================== -->
<!-- sitemap in directory 'home' -->
<!-- this is the main sitemap for my directory structure -->
<!-- ============================================== -->
  <map:match pattern="*/*/*.protected">
    <map:aggregate element="page" label="xml-code">
      <map:part element="header" src="cocoon:/frame/header"/>
      <map:part element="navigation" src="cocoon:/frame/navigation-{1}/{2}"/>
      <map:part element="content" label="content"
                src="cocoon:/content/protected-{1}/{2}/{3}"/>
      <map:part element="navigation-footer"
                src="cocoon:/frame/navigation/navigation-footer-{1}"/>
      <map:part element="footer" src="cocoon:/frame/footer"/>
    </map:aggregate>
    <map:transform label="html-code" src="context://home/styles/xsl/style.xsl"/>
    <map:serialize type="html"/>
  </map:match>

<!-- ============================================== -->
<!-- mounted sitemap in directory 'content' -->
<!-- ============================================== -->
  <map:match pattern="protected-*/*/*">
    <map:aggregate element="content" label="xml-code">
      <map:part element="submain"
                src="cocoon:/../frame/navigation/submain-{1}/{2}/{3}"/>
      <map:part element="article" label="content"
                src="cocoon:/protected/{1}/{2}/{3}"/>
      <map:part element="boxes" src="cocoon:/boxes"/>
    </map:aggregate>
    <map:transform src="context://home/styles/xsl/content.xsl"/>
    <map:serialize type="xml"/>
  </map:match>

<!-- ============================================== -->
<!-- mounted sitemaps in directory 'protected' and 'folder1' -->
<!-- ============================================== -->
  <map:match pattern="*/**">
    <map:mount check-reload="yes" src="{1}/" uri-prefix="{1}"/>
  </map:match>

<!-- ============================================== -->
<!-- mounted sitemap in directory 'subfolder1'  -->
<!-- ============================================== -->
  <map:component-configurations>
    <authentication-manager>
      <handlers>
        <handler name="myHandler">
          <redirect-to uri="cocoon:/login"/>
          <authentication uri="cocoon:raw:/authenticate"/>
        </handler>
      </handlers>
    </authentication-manager>
  </map:component-configurations>

<!-- ============================================== -->
  <map:pipeline>

    <map:match pattern="page">
      <map:redirect-to uri="cocoon:/login"/>
    </map:match>

    <map:match pattern="login">
      <!-- if we are already logged in, redirect to the protected document -->
      <map:act type="auth-loggedIn">
        <map:parameter name="handler" value="myHandler"/>
        <map:redirect-to uri="protected"/>
      </map:act>
      <map:generate src="context://home/content/protected/login.xml"/>
      <map:transform src="context://home/styles/xsl/login.xsl"/>
      <map:transform type="encodeURL"/>
      <map:serialize type="html"/>
    </map:match>

    <map:match pattern="do-login">
      <!-- try to login -->
      <map:act type="auth-login">
        <map:parameter name="handler" value="myHandler"/>
        <!-- user = parameter aus formular -->
        <map:parameter name="parameter_user" value="{request-param:user}"/>
        <map:parameter name="parameter_password"
                       value="{request-param:password}"/>
        <!-- authentication successfully -->
        <map:redirect-to uri="protected"/>
      </map:act>
      <!-- something was wrong, try it again -->
      <map:redirect-to uri="login"/>
    </map:match>

    <map:match pattern="protected">
      <map:act type="auth-protect">
        <map:parameter name="handler" value="myHandler"/>
        <map:generate
src="context://home/content/protected/folder1/subfolder1/protected-file1.xml"/>
        <map:transform type="session"/>
        <map:transform src="context://home/styles/xsl/article.xsl"/>
        <map:transform type="encodeURL"/>
        <map:serialize type="html"/>
      </map:act>
      <!-- something was wrong, redirect to login page -->
      <map:redirect-to uri="login"/>
    </map:match>

    <map:match pattern="do-logout">
      <map:act type="auth-protect">
        <map:parameter name="handler" value="myHandler"/>
        <map:act type="auth-logout"/>
      </map:act>
      <map:redirect-to uri="login"/>
    </map:match>

  </map:pipeline>
<!-- ============================================== -->

  <map:pipeline internal-only="true">
    <map:match pattern="authenticate">
      <map:generate src="context://home/logic/xsp/authenticate.xsp"
                    type="serverpages"/>
      <map:transform src="context://home/logic/logicsheets/authenticate.xsl">
        <map:parameter name="use-request-parameters" value="true"/>
      </map:transform>
      <map:serialize type="xml"/>
    </map:match>
  </map:pipeline>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message