David, found it, here we go: You matcher must become something like:
<map:match pattern="getXSD.xml">
<map:call function="checkSession">
<map:parameter name="username" value="{globalconstants:username}"/>
<map:parameter name="password" value="{globalconstants:password}"/>
<map:parameter name="uri" value="loggedin-getXSD.xml"/>
</map:call>
</map:match>
In globalconstants or somewhere else, you store a username and password (for
example, a read only one, like siteuser, if you do not have to write)
In a flow.js, you add:
cocoon.load("site:/login/login.js");
/* if there is no session this function will take care of logging in
*/
function autologin() {
if(cocoon.session.getAttribute("httpstate") == null){
do_login(cocoon.parameters.username,
cocoon.parameters.password, null, "nl");
cocoon.session.setAttribute("autologout","true");
}
var uri = cocoon.parameters.uri;
cocoon.sendPage(uri);
}
So, only when you did *not* already have a session, you set an attribute
"autologout". You do not want to auto-logout, if you already had a session,
right?
Now, add
<map:match pattern="loggedin-getXSD.xml">
<map:generate src="dasl-multi-in.xml" type="jx">
<map:parameter name="target" value="{repository:files}"/>
<map:parameter name="path" value="content/"/>
<map:parameter name="id" value="{request-param:id}"/>
<map:parameter name="nrOfResults" value="10"/>
</map:generate>
<map:transform type="webdav"/>
<map:transform type="autologout"/>
<map:serialize type="xml"/>
</map:match>
And to your sitemap components add:
<map:components>
<map:transformers default="xslt">
<map:transformer logger="sitemap.transformers" name="autologout"
src="nl.hippo.cocoon.transformation.AutoLogoutTransformer"/>
</map:transformers>
</map:components>
That is all, and should be working out of the 'box' :-)
Let me know if this helps you,
Regards Ard
> Ard,
>
> yee, It's exaclty what I want and I will prefer the first
> solution. So we could have a "package of urls" completly
> available without being logged in the cms.
>
> I will try the flowscript but your custom logout transformer
> may be useful
> ;-)
>
> Thank !
>
> David Calcus
> Smals - F. Manini - Web Content Management Rue du Prince
> Royal 102, 1050 Bruxelles [EMAIL PROTECTED]
> +32 (0)2 787 54 92
> ______________________________________________________________
> ________________________________
> Smals sluit elke aansprakelijkheid uit in verband met de
> juistheid, de volledigheid of het tijdig toekomen van de
> informatie in deze e-mail. Aan deze e-mail kunnen geen
> rechten worden ontleend en deze e-mail houdt in geen geval
> een erkenning van welkdanige aansprakelijkheid in.
> Dit bericht is alleen bestemd voor de geadresseerde. Indien
> dit bericht niet voor u bestemd is, verzoeken wij u dit
> onmiddellijk aan ons te melden en het bericht te vernietigen.
>
> Smals décline toute responsabilité quant à l'exactitude, à
> l'exhaustivité et au délai de transmission des informations
> contenues dans cet e-mail.
> Aucun droit ne peut être revendiqué sur cet e-mail et cet
> e-mail n'implique en aucun cas une reconnaissance de
> responsabilité, quelle qu'elle soit.
> Ce message s'adresse uniquement au destinataire. Si ce
> message ne vous est pas destiné, nous vous prions de nous le
> signaler immédiatement et de détruire le message.
>
>
>
> Ard Schrijvers <[EMAIL PROTECTED]> Sent by:
> [EMAIL PROTECTED]
> 23/05/2008 15:03
> Please respond to
> Hippo CMS development public mailinglist
> <[email protected]>
>
>
>
>
>
> To
> Hippo CMS development public mailinglist
> <[email protected]>
> cc
>
> Subject
> RE: [HippoCMS-dev] DASL in the CMS without credentials
>
>
>
>
>
>
> Hello David,
>
> I understand you want to be able to use your java class without being
> logged in into the cms right? Because, if you first login,
> you wouldn't
> have this problem, because the session then has the
> credentials to login.
> Therefor I conclude you want to call some url, without being
> logged in,
> correct? At least, I suppose you are calling some url, otherwise you
> wouldn't have a host, hence the repository wouldn't be
> resolved, and I see
> the repository is solved.
>
> If I am correct, then there are to easy options:
>
> 1) set the session credentials through flowscript, like the
> flowscript for
> the login in the cms
> 2) set the session credentials in your java class.
>
> Do realize however, that after automatically loggin in, you
> have to logout
> again, otherwise, after calling the url with the 'auto-login'
> you can go
> in the cms without logging in anymore. I recently build
> something similar
> and added a custom logout transformer at the end of the
> pipeline after the
> webdav transformer.
>
> Let me know wether this is what you're after,
>
> Regards Ard
>
> >
> > Hi Ard,
> >
> > Let's me try to explain again ;-)
> >
> > In fact, we have added a new pipeline in the extension folder :
> >
> > <map:match pattern="getXSD.xml">
> > <map:generate src="dasl-multi-in.xml" type="jx">
> > <map:parameter name="target" value="{repository:files}"/>
> > <map:parameter name="path" value="content/"/>
> > <map:parameter name="id" value="{request-param:id}"/>
> > <map:parameter name="nrOfResults" value="10"/>
> > </map:generate>
> > <map:transform type="webdav"/>
> > <!--map:transform src="stripnamespaces.xsl"/>
> > <map:transform src="schema.xsl"/-->
> > <map:serialize type="xml"/>
> > </map:match>
> >
> > and we call this from a java classe to get information from
> > the repository.
> >
> > The dasl response did'nt work because of the credentials :
> >
> > <webdav:response
> > target="http://cmtest:9040/multisite/files/multisite.preview"
> > method="SEARCH">
> > <webdav:status code="401" msg="Unauthorized"/> <webdav:header
> > name="Date" value="Fri, 23 May 2008 12:26:41 GMT"/>
> > <webdav:header name="Server" value="Jetty/5.1.12 (SunOS/5.8
> > sparc java/1.4.2_17"/> <webdav:header name="WWW-Authenticate"
> > value="basic realm="multisite realm""/> <webdav:header
> > name="Content-Type" value="text/html"/> <webdav:header
> > name="Content-Length" value="1252"/> </webdav:response>
> >
> > So is it possible to force the authorization for some
> > specific urls? So we don't have to manage the credentials in
> > our java method.
> >
> > So we don't want to copy any result into the repository...
> >
> > Hope that help...
> >
> >
> > Furthermore we can extend our cms to show a preview site
> > where any login/password will be needed.
> >
> >
> > David Calcus
> > Smals - F. Manini - Web Content Management
> > Rue du Prince Royal 102, 1050 Bruxelles
> > [EMAIL PROTECTED]
> > +32 (0)2 787 54 92
> > ______________________________________________________________
> > ________________________________
> > Smals sluit elke aansprakelijkheid uit in verband met de
> > juistheid, de
> > volledigheid of het tijdig toekomen van de informatie in deze
> > e-mail. Aan
> > deze e-mail kunnen geen rechten worden ontleend en deze
> > e-mail houdt in
> > geen geval een erkenning van welkdanige aansprakelijkheid in.
> > Dit bericht is alleen bestemd voor de geadresseerde. Indien
> > dit bericht
> > niet voor u bestemd is, verzoeken wij u dit onmiddellijk aan
> > ons te melden
> > en het bericht te vernietigen.
> >
> > Smals décline toute responsabilité quant à l'exactitude, à
> > l'exhaustivité
> > et au délai de transmission des informations contenues dans
> > cet e-mail.
> > Aucun droit ne peut être revendiqué sur cet e-mail et cet e-mail
> > n'implique en aucun cas une reconnaissance de
> responsabilité, quelle
> > qu'elle soit.
> > Ce message s'adresse uniquement au destinataire. Si ce
> > message ne vous est
> > pas destiné, nous vous prions de nous le signaler
> immédiatement et de
> > détruire le message.
> >
> >
> >
> > Ard Schrijvers <[EMAIL PROTECTED]>
> > Sent by: [EMAIL PROTECTED]
> > 23/05/2008 14:09
> > Please respond to
> > Hippo CMS development public mailinglist
> > <[email protected]>
> >
> >
> >
> >
> >
> > To
> > Hippo CMS development public mailinglist
> > <[email protected]>
> > cc
> >
> > Subject
> > RE: [HippoCMS-dev] DASL in the CMS without credentials
> >
> >
> >
> >
> >
> >
> > Hello David,
> >
> > First let me get it right what you want:
> >
> > You have added some avalon component in the cms, which needs
> > to be able to
> > do a dasl, and do something with the result, something like the
> > WebDAVTransformer, or, do I get it wrong (Launching a dals into the
> > repository confuses me a little. It sounds like saving a
> dasl in the
> > repository and execute it there and get the response as a
> repository
> > source...that is how I first interpreted your mail)
> >
> > Anyway, if you could clarify a bit...
> >
> > Regards Ard
> >
> > > Hi folks,
> > >
> > > We add a new extension into the cms to launch a dasl into the
> > > repository.
> > > This extension is called by java method to get some
> > > information from the repository. Is it possible to force the
> > > authorization (something with the
> > > sitemap) to get a valid dasl response? We want to spare the
> > > credentials business into the java method. Actually we want
> > > to ask a dasl with a valid result : a bit like the front-end
> > > does but using the cms...
> > >
> > > Any ideas how to do it?
> > >
> > > Thanks a lot.
> > >
> > > David Calcus
> > > Smals - F. Manini - Web Content Management Rue du Prince
> > > Royal 102, 1050 Bruxelles [EMAIL PROTECTED]
> > > +32 (0)2 787 54 92
> > > ______________________________________________________________
> > > ________________________________
> > > Smals sluit elke aansprakelijkheid uit in verband met de
> > > juistheid, de volledigheid of het tijdig toekomen van de
> > > informatie in deze e-mail. Aan deze e-mail kunnen geen
> > > rechten worden ontleend en deze e-mail houdt in geen geval
> > > een erkenning van welkdanige aansprakelijkheid in.
> > > Dit bericht is alleen bestemd voor de geadresseerde. Indien
> > > dit bericht niet voor u bestemd is, verzoeken wij u dit
> > > onmiddellijk aan ons te melden en het bericht te vernietigen.
> > >
> > > Smals décline toute responsabilité quant à l'exactitude, à
> > > l'exhaustivité et au délai de transmission des informations
> > > contenues dans cet e-mail.
> > > Aucun droit ne peut être revendiqué sur cet e-mail et cet
> > > e-mail n'implique en aucun cas une reconnaissance de
> > > responsabilité, quelle qu'elle soit.
> > > Ce message s'adresse uniquement au destinataire. Si ce
> > > message ne vous est pas destiné, nous vous prions de nous le
> > > signaler immédiatement et de détruire le message.
> > >
> > ********************************************
> > Hippocms-dev: Hippo CMS development public mailinglist
> >
> > ********************************************
> > Hippocms-dev: Hippo CMS development public mailinglist
> >
> ********************************************
> Hippocms-dev: Hippo CMS development public mailinglist
>
> ********************************************
> Hippocms-dev: Hippo CMS development public mailinglist
>
AutoLogoutTransformer.java
Description: AutoLogoutTransformer.java
******************************************** Hippocms-dev: Hippo CMS development public mailinglist
