Hi Nacho,

thanks again ;-)

I tried to apply your hint to my sitemap but it doesn't work yet, thus I
solved (I hope) the problem storing the user id as a session attribute.

Anyway I include my sitemap (the real not a test) cause I think it's a weird
thing it's so hard to retrieve this information from the authentication
framework, and I'm sure I mistake something (or maybe many things).

Just one clarification : in the userOut action a make only a printout of
the pool parameter.

Last thing : where can I find documentation about session-context input
module ?
I found this link http://wiki.cocoondev.org/Wiki.jsp?page=InputModules but
the session-context is not mentioned.

Many thanks again

Flavio


<?xml version="1.0"?>

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
<!-- =========================== Components ================================
-->
 <map:components>

  <map:generators default="file">
  </map:generators>

  <map:transformers default="xslt">
  </map:transformers>

  <map:readers default="resource">
  </map:readers>

  <map:serializers default="html">
  </map:serializers>

  <map:selectors default="browser">
  </map:selectors>

  <map:matchers default="wildcard">
  </map:matchers>

  <map:actions>
   <map:action name="AddM9" logger="sitemap.riskIdem.action.AddM9Action"
               src="AddM9Action"/>
   <map:action name="CtrM9" logger="sitemap.riskIdem.action.CtrM9Action"
               src="CtrM9Action"/>
   <map:action name="UserIn" logger="sitemap.riskIdem.action.UserInAction"
               src="UserInAction"/>
   <map:action name="UserOut" logger="sitemap.riskIdem.action.UserOutAction"
               src="UserOutAction"/>
  </map:actions>

 </map:components>
<!-- ========================== Action sets ================================
-->
 <map:action-sets>
  <map:action-set name="process">
   <map:act type="CtrM9" action="GestioneOperazioni">
     <map:parameter name="pool" value="riskIdem"/>
       <map:act type="AddM9">
        <map:parameter name="pool" value="riskIdem"/>
        <map:parameter name="nazi" value="{sNazione}"/>
        <map:parameter name="merc" value="{sMercato}"/>
        <map:parameter name="grst" value="{sGruppoStrumenti}"/>
        <map:parameter name="modi" value="{sModificatore}"/>
        <map:parameter name="sott" value="{sCodiceSotto}"/>
        <map:parameter name="scad" value="{sDataScadenza}"/>
        <map:parameter name="stri" value="{sStrike}"/>
       </map:act>
   </map:act>
  </map:action-set>

  <map:action-set name="login">
   <map:act type="auth-login">
    <map:parameter name="handler" value="protArea"/>
    <map:parameter name="parameter_name" value="{request-param:username}"/>
    <map:parameter name="parameter_pass" value="{request-param:password}"/>
     <map:act type="UserIn">
      <map:parameter name="pool" value="riskIdem"/>
      <map:parameter name="user" value="{request-param:username}"/>
     </map:act>
   </map:act>
  </map:action-set>

 </map:action-sets>
<!-- =========================== Pipelines =================================
-->
 <map:pipelines>

    <map:component-configurations>
      <authentication-manager>
        <handlers>
          <handler name="protArea">
            <redirect-to uri="cocoon:/login"/>
            <authentication uri="cocoon:raw:/authenticate"/>
          </handler>
        </handlers>
      </authentication-manager>
    </map:component-configurations>

    <map:pipeline>

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

      <!-- ================= -->
      <!-- Simple login page -->
      <!-- ================= -->
      <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="protArea"/>
          <map:redirect-to uri="protected/home"/>
        </map:act>
        <map:generate type="serverpages" src="docs/login.xml"/>
        <map:transform src="stylesheets/apache.xsl"/>
        <map:transform type="encodeURL"/>
        <map:serialize/>
      </map:match>

      <!-- ========================================= -->
      <!-- Form target which performs auth service   -->
      <!-- ========================================= -->
      <map:match pattern="do-login">
        <!-- try to login -->
        <map:act set="login">
          <map:redirect-to uri="protected/home"/>
        </map:act>
        <!-- something was wrong, try it again -->
        <map:redirect-to uri="login?sCodErr=01"/>
      </map:match>

      <!-- ================ -->
      <!-- Protected area   -->
      <!-- ================ -->
      <map:match pattern="protected/**">
        <map:act type="auth-protect">
          <map:parameter name="handler" value="protArea"/>

          <map:match pattern="protected/home">
            <map:generate src="docs/home.xml"/>
            <map:transform type="session"/>
            <map:transform src="stylesheets/apache.xsl"/>
            <map:transform type="encodeURL"/>
            <map:serialize/>
          </map:match>

          <map:match pattern="protected/*-operaz.html">
            <map:generate type="serverpages" src="docs/{1}-operaz.xsp"/>
            <map:transform src="stylesheets/apache.xsl"/>
            <map:serialize/>
          </map:match>

          <map:match pattern="protected/immissione-eseguiti.html">
           <map:act set="process">
            <map:redirect-to uri="conferma-immiss.html?sTipo=I&amp;sNumIns={sNumIns}"/>
           </map:act>
            <map:generate type="serverpages" src="docs/immissione-operaz.xsp"/>
            <map:transform src="stylesheets/apache.xsl"/>
            <map:serialize/>
          </map:match>

          <map:match pattern="protected/cancella-eseguiti.html">
           <map:act set="process">
            <map:redirect-to uri="conferma-immiss.html?sTipo=C&amp;sNumCan={sNumCan}"/>
           </map:act>
            <map:generate type="serverpages" src="docs/cancella-operaz.xsp"/>
            <map:transform src="stylesheets/apache.xsl"/>
            <map:serialize/>
          </map:match>

          <map:match pattern="protected/modifica-eseguiti.html">
           <map:act set="process">
            <map:redirect-to 
uri="conferma-immiss.html?sTipo=M&amp;sNumIns={sNumIns}&amp;sNumCan={sNumCan}"/>
           </map:act>
            <map:generate type="serverpages" src="docs/modifica-operaz.xsp"/>
            <map:transform src="stylesheets/apache.xsl"/>
            <map:serialize/>
          </map:match>

          <map:match pattern="protected/modificaOM-eseguiti.html">
           <map:act set="process">
            <map:redirect-to 
uri="conferma-immiss.html?sTipo=M&amp;sNumIns={sNumIns}&amp;sNumCan={sNumCan}"/>
           </map:act>
            <map:generate type="serverpages" src="docs/modificaOM-operaz.xsp"/>
            <map:transform src="stylesheets/apache.xsl"/>
            <map:serialize/>
          </map:match>

          <map:match pattern="protected/posiz-clie.html">
            <map:generate type="serverpages" src="docs/posiz-clie.xsp"/>
            <map:transform src="stylesheets/apache.xsl"/>
            <map:serialize/>
          </map:match>

          <map:match pattern="protected/conferma-immiss.html">
            <map:generate type="serverpages" src="docs/conferma-operaz.xsp"/>
            <map:transform src="stylesheets/apache.xsl"/>
            <map:serialize/>
          </map:match>

          <map:match pattern="protected/*-openp.html">
           <map:generate type="serverpages" src="docs/{1}-openp.xsp"/>
           <map:transform src="stylesheets/apache.xsl"/>
           <map:serialize/>
          </map:match>

          <map:match pattern="protected/Ricerca-*.html">
            <map:generate type="serverpages" src="docs/Ricerca-{1}.xsp"/>
            <map:transform src="stylesheets/apache.xsl"/>
            <map:serialize/>
          </map:match>

          <map:match pattern="protected/images/**.gif">
            <map:read src="resources/images/{1}.gif" mime-type="image/gif"/>
          </map:match>

          <map:match pattern="protected/images/**.jpg">
            <map:read src="resources/images/{1}.jpg" mime-type="image/jpg"/>
          </map:match>

          <map:match pattern="protected/images/**.png">
            <map:read src="resources/images/{1}.png" mime-type="image/png"/>
          </map:match>

          <map:match pattern="protected/resources/**.css">
            <map:read src="resources/styles/{1}.css" mime-type="text/css"/>
          </map:match>

          <map:match pattern="protected/resources/**.js">
            <map:read src="resources/styles/{1}.js" 
mime-type="application/x-javascript"/>
          </map:match>

          <!-- ========================================= -->
          <!-- Logout link which invalidates the session -->
          <!-- ========================================= -->
          <map:match pattern="protected/do-logout">
           <map:act type="auth-protect">
            <map:parameter name="handler" value="protArea"/>
             <map:act type="UserOut">
              <map:parameter name="pool" value="{session-context:authentication/ID}"/>
             </map:act>
             <map:act type="auth-logout"/>
           </map:act>
           <map:redirect-to uri="../login"/>
          </map:match>

        </map:act>

        <!-- something was wrong, redirect to login page -->
        <map:redirect-to uri="login"/>
      </map:match>


   <map:match pattern="images/**.jpg">
    <map:read src="resources/images/{1}.jpg" mime-type="image/jpg"/>
   </map:match>

    </map:pipeline>

   <map:pipeline internal-only="true">
      <map:match pattern="authenticate">
        <map:generate type="serverpages" src="docs/autenticaLogin.xsp"/>
          <map:parameter name="use-request-parameters" value="true"/>
        <map:transform src="stylesheets/autentica.xsl"/>
        <map:serialize type="xml"/>
      </map:match>

  </map:pipeline>
 </map:pipelines>

</map:sitemap>


>-- Original Message --
>Reply-To: [EMAIL PROTECTED]
>Date: Fri, 14 May 2004 11:22:04 +0100
>From: Nacho Jimenez <[EMAIL PROTECTED]>
>To:  [EMAIL PROTECTED]
>Subject: Re: retrieve user in logout action
>
>
>Flavio Palumbo wrote:
>
>>Hi Nacho,
>>
>>thank you for the replay, I tried to follow your cues but I didn't solve
>>it.
>>
>>I tried to modify the authentication block samples sitemap as follow :
>>
>><map:pipeline>
>>
>>   ....
>>
>>      <!-- ========================================= -->
>>      <!-- Logout link which invalidates the session -->
>>      <!-- ========================================= -->
>>      <map:match pattern="protected/do-logout">
>>        <map:act type="auth-protect">
>>          <map:parameter name="handler" value="demohandler"/>
>>
>>          <map:generate type="serverpages" src="docs/prova.xsp">
>>           <map:parameter name="ups" value="{request:remoteUser}"/>
>>          </map:generate>
>>          <map:serialize/>
>>          <map:act type="auth-logout"/>
>>          <map:redirect-to uri="login"/>
>>        </map:act>
>>      </map:match>
>>    </map:pipeline>
>>
>> and prova.xsp looks like below :
>>
>><?xml version="1.0"?>
>><xsp:page xmlns:xsp="http://apache.org/xsp";
>>          xmlns:xsp-request="http://apache.org/xsp/request/2.0";
>>xmlns:util="http://apache.org/xsp/util/2.0";>
>>
>><page>
>> <xsp:logic>System.out.println("prova.xsp"+<util:get-sitemap-parameter
name="ups"/>);</xsp:logic>
>></page>
>></xsp:page>
>>
>>but in the output of the console I'm not able to find the user ID.
>>
>>May you help me find where I mistake ?
>>
>>
>As far as I know, actions have to take place before page production.. In
>
>your use case, what you need is that when a logout is correctly done,
>you log the event and then redirect the user, I would do it like this:
>
>      <map:match pattern="protected/do-logout">
>        <map:act type="auth-protect">
>          <map:parameter name="handler" value="demohandler"/>
>          <map:act type="auth-logout">
>           <map:act type="xsp-action" src="docs/prova.xsp">
>            <map:parameter name="ups" value="{session-context:authentication/ID}"/>
>            <map:redirect-to uri="login"/>
>           </map:act>
>         </map:act>
>       </map:act>
>      </map:match>
>
>Note that I take the parameter from the authentication context, not from
>
>the request.. I don't think that the auth fw's follows the http
>authentication lines and saves the user in the request..
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to