You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Pe...@mediacenter.nl on 2005/05/02 18:34:41 UTC

Betr.: Re: Betr.: authentication-fw





Andre Juffer <An...@oulu.fi> wrote on 02-05-2005 14:42:19:

> Peter.Urbanus@mediacenter.nl wrote:
> >
> >
> >
> >
> > Andre Juffer <aj...@sun3.oulu.fi> wrote on 30-04-2005 14:52:29:
> >
> >
> >>Peter and others,
> >>
> >>concerning the authentication resource, I eventually found the
following
> >>in core.log:
> >>
> >>DEBUG   (2005-04-30) 15:28.26:711   [core.authentication-manager]
> >>(/sopas/do-login) http-8080-Processor25/PipelineAuthen
> >>ticator: BEGIN isValidAuthenticationFragment fragment=<?xml
> >>version="1.0" encoding="UTF-8"?>
> >
> > When the PipelineAuthenticator starts validating the XML fragment, it
> > prints the entire fragment to the log. So at that point, your entire
> > fragment is
> >       <?xml version="1.0" encoding="UTF-8"?>
> > and nothing else, no <authentication> etc.
> >
> > Perhaps this helps?
>
> Actually, in the log file, there is an empty line just below
> DEBUG   (2005-04-30) 15:28.26:711   [core.authentication-manager]
> (/sopas/do-login) http-8080-Processor25/PipelineAuthen
> ticator: BEGIN isValidAuthenticationFragment fragment=<?xml
> version="1.0" encoding="UTF-8"?>
>
> While the authenticator definitly returns the correct response (see
> previous emails), the rest of the document is not available to the
> PipelineAuthenticator, it apparently just gets the first line. By
> looking at the source code of PipelineAuthenticator, I thought initially
> that the <?xml version="1.0" encoding="UTF-8"?> should not be there,
> just the XML itself, but this seems rubbish now.
>
> I guess I somehow need to get rid of new lines characters or spaces or
> whatsoever in the returned XML document, so that the
> PipelineAuthenticator sees one line only. Maybe that is the solution to
> this. So, instead of
>
> <?xml version="1.0" encoding="UTF-8"?>
> <authentication>
> ...
> </authentication>
>
> I would need to generate
>
> <?xml version="1.0"
encoding="UTF-8"?><authentication>...</authentication>
>
> (this all is one line).
>
I would be surprised if it was the whitespace. But I have no explanation
yet. So while nobody steps in and tells us what the problem is, we'll just
have to stumble forward. Let's see what we have:
- When you type ...authenticate.xxx in your browser, you get the right XML
- When authenticate.xxx is called during authentication, it is mostly empty
So there must be *some* difference. The only differences I can think of are
request parameters. So you could test a situation where request parameters
cannot screw you up. You could simply create an XML somedir/test.xml like
this:
  <?xml version="1.0" encoding="UTF-8"?>
  <authentication>
    <ID>Me</ID>
  </authentication>
And then change your sitemap like this:
  <map:match pattern="authenticate.xxx">
    <map:generate src="somedir/test.xml" />
    <map:serialize type="xml" />
  </map:match>
If this works (it must!) there are only three possibilities left (that I
can think of):
- the extra match <map:match type="request-parameter" pattern="userid"> is
wrong
- something in authenticate.xsl
- something fishy in the XML produced by the XML database.
I've never worked with XML databases, so I can't help you there.

Best of luck,
Peter


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


Betr.: Re: Betr.: Re: Betr.: Re: Betr.: authentication-fw

Posted by Pe...@mediacenter.nl.




Andre Juffer <aj...@sun3.oulu.fi> wrote on 02-05-2005 22:36:53:

> Peter.Urbanus@mediacenter.nl wrote:
> >
> >
> > In particular, what happens if you add the extra match <map:match
> > type="request-parameter" pattern="userid"> into your simplified
> > "authenticate" pipeline above?
>
>      <map:match pattern="authenticate">
>        <map:match type="request-parameter" pattern="userid">
>          <map:generate src="/tmp/authenticate.xml" />
>          <map:serialize type="xml" />
>        </map:match>
>      </map:match>
>
>
> Authentication works. But the same file is being used of course
> (/tmp/authenticate.xml), so it should work.

Agreed. I just wanted to exclude the possibility that this match didn't
"match".
And what happens if you add whitespace to your /tmp/authenticate.xml? In my
setup, I can add all the whitespace I like and it still works. So, assuming
it's not the whitespace, we have two pipelines

<map:match pattern="authenticate.xxx">
  <map:match type="request-parameter" pattern="userid">
    <map:generate src="/tmp/authenticate.xml" />
    <map:serialize type="xml" />
   </map:match>
</map:match>

and

<map:match pattern="authenticate.xxx">
   <map:match type="request-parameter" pattern="userid">
     <map:generate src="cocoon://persistence/get-party?email={1}" />
     <map:transform src="docs/xsl/authenticate.xsl">
       <map:parameter name="use-request-parameters" value="true" />
     </map:transform>
     <map:serialize type="xml" />
   </map:match>
</map:match>

First one works, second one doesn't.
Time to look at authenticate.xsl then? I would like to have a look at it.

There is one other thing you could do: use the LogTransformer to see the
SAX events. like this:

<map:match pattern="authenticate.xxx">
  <map:match type="request-parameter" pattern="userid">
    <map:generate src="cocoon://persistence/get-party?email={1}" />
    <map:transform src="docs/xsl/authenticate.xsl">
      <map:parameter name="use-request-parameters" value="true" />
    </map:transform>
    <map:transform type="log">
      <map:parameter name="logfile" value="authenticate.log"/>
      <map:parameter name="append" value="yes"/>
    </map:transform>
    <map:serialize type="xml" />
  </map:match>
</map:match>

Regards, Peter


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


Re: Betr.: Re: Betr.: Re: Betr.: authentication-fw

Posted by Andre Juffer <aj...@sun3.oulu.fi>.
Peter.Urbanus@mediacenter.nl wrote:
> 
> 
> In particular, what happens if you add the extra match <map:match
> type="request-parameter" pattern="userid"> into your simplified
> "authenticate" pipeline above?

     <map:match pattern="authenticate">
       <map:match type="request-parameter" pattern="userid">
         <map:generate src="/tmp/authenticate.xml" />
         <map:serialize type="xml" />
       </map:match>
     </map:match>


Authentication works. But the same file is being used of course 
(/tmp/authenticate.xml), so it should work.

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


-- 
Andre H. Juffer              | Phone: +358-8-553 1161
The Biocenter and            | Fax: +358-8-553-1141
     the Dep. of Biochemistry | Email: Andre.Juffer@oulu.fi
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/

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


Betr.: Re: Betr.: Re: Betr.: authentication-fw

Posted by Pe...@mediacenter.nl.



Andre Juffer <aj...@sun3.oulu.fi> wrote on 02-05-2005 22:06:16:

> Hi Peter,
>
> thanks again. I already experimented with a XML file earlier today. It
> is really ridiculous: if I save the XML document generated by the
> original authenticator to file as (e.g.) /tmp/authentication.xml and
> modify the sitemap to:
>
>      <map:match pattern="authenticate">
>        <map:generate src="/tmp/authenticate.xml" />
>        <map:serialize type="xml" />
>      </map:match>
>
> the authentication works fine!

Look at the other lines I wrote:

> > If this works (it must!) there are only three possibilities left (that
I
> > can think of):
> > - the extra match <map:match type="request-parameter" pattern="userid">
is
> > wrong
> > - something in authenticate.xsl
> > - something fishy in the XML produced by the XML database.
> > I've never worked with XML databases, so I can't help you there.
> >

In particular, what happens if you add the extra match <map:match
type="request-parameter" pattern="userid"> into your simplified
"authenticate" pipeline above?

Cheers,
Peter


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


Re: Betr.: Re: Betr.: authentication-fw

Posted by Andre Juffer <aj...@sun3.oulu.fi>.
Hi Peter,

thanks again. I already experimented with a XML file earlier today. It 
is really ridiculous: if I save the XML document generated by the 
original authenticator to file as (e.g.) /tmp/authentication.xml and 
modify the sitemap to:

     <map:match pattern="authenticate">
       <map:generate src="/tmp/authenticate.xml" />
       <map:serialize type="xml" />
     </map:match>

the authentication works fine! NOTE AGAIN: The authenticate.xml is an 
-exact- copy  of the XML document produced by the orginal authenticator 
with the two SAME request parameters password and userid that I have 
used before! The only difference is that the result of the authenticator 
is stored in a file. The content of the /tmp/authentication.xml is

<?xml version="1.0" encoding="ISO-8859-1"?>
<authentication>
  <ID>1113937509670</ID>
   <surname>juffer</surname>
   <email>andre.juffer@oulu.fi</email>
   <role>author</role>
</authentication>

(I have put things on separate lines for readability. The part after 
<?xml version="1.0" encoding="ISO-8859-1"?> is on a single line in the 
file.)

The core.log now correctly shows

DEBUG   (2005-05-02) 22:42.45:311   [core.authentication-manager] 
(/sopas/do-login) http-8080-Processor24/PipelineAuthen
ticator: BEGIN isValidAuthenticationFragment fragment=<?xml 
version="1.0" encoding="UTF-8"?>
<authentication><ID>1113937509670</ID><surname>juffer</surname><email>andre.juffer@oulu.fi</email><role>author</role></a
uthentication>

Remember that with the original pipeline in the sitemap the part after 
<?xml version="1.0" encoding="ISO-8859-1"?> is simply not available in 
the PipelineAuthenticator. It should simply work!


Andre.

Peter.Urbanus@mediacenter.nl wrote:
> 
> 
> 
> 
> Andre Juffer <An...@oulu.fi> wrote on 02-05-2005 14:42:19:
> 
> 
>>Peter.Urbanus@mediacenter.nl wrote:
>>
>>>
>>>
>>>
>>>Andre Juffer <aj...@sun3.oulu.fi> wrote on 30-04-2005 14:52:29:
>>>
>>>
>>>
>>>>Peter and others,
>>>>
>>>>concerning the authentication resource, I eventually found the
> 
> following
> 
>>>>in core.log:
>>>>
>>>>DEBUG   (2005-04-30) 15:28.26:711   [core.authentication-manager]
>>>>(/sopas/do-login) http-8080-Processor25/PipelineAuthen
>>>>ticator: BEGIN isValidAuthenticationFragment fragment=<?xml
>>>>version="1.0" encoding="UTF-8"?>
>>>
>>>When the PipelineAuthenticator starts validating the XML fragment, it
>>>prints the entire fragment to the log. So at that point, your entire
>>>fragment is
>>>      <?xml version="1.0" encoding="UTF-8"?>
>>>and nothing else, no <authentication> etc.
>>>
>>>Perhaps this helps?
>>
>>Actually, in the log file, there is an empty line just below
>>DEBUG   (2005-04-30) 15:28.26:711   [core.authentication-manager]
>>(/sopas/do-login) http-8080-Processor25/PipelineAuthen
>>ticator: BEGIN isValidAuthenticationFragment fragment=<?xml
>>version="1.0" encoding="UTF-8"?>
>>
>>While the authenticator definitly returns the correct response (see
>>previous emails), the rest of the document is not available to the
>>PipelineAuthenticator, it apparently just gets the first line. By
>>looking at the source code of PipelineAuthenticator, I thought initially
>>that the <?xml version="1.0" encoding="UTF-8"?> should not be there,
>>just the XML itself, but this seems rubbish now.
>>
>>I guess I somehow need to get rid of new lines characters or spaces or
>>whatsoever in the returned XML document, so that the
>>PipelineAuthenticator sees one line only. Maybe that is the solution to
>>this. So, instead of
>>
>><?xml version="1.0" encoding="UTF-8"?>
>><authentication>
>>...
>></authentication>
>>
>>I would need to generate
>>
>><?xml version="1.0"
> 
> encoding="UTF-8"?><authentication>...</authentication>
> 
>>(this all is one line).
>>
> 
> I would be surprised if it was the whitespace. But I have no explanation
> yet. So while nobody steps in and tells us what the problem is, we'll just
> have to stumble forward. Let's see what we have:
> - When you type ...authenticate.xxx in your browser, you get the right XML
> - When authenticate.xxx is called during authentication, it is mostly empty
> So there must be *some* difference. The only differences I can think of are
> request parameters. So you could test a situation where request parameters
> cannot screw you up. You could simply create an XML somedir/test.xml like
> this:
>   <?xml version="1.0" encoding="UTF-8"?>
>   <authentication>
>     <ID>Me</ID>
>   </authentication>
> And then change your sitemap like this:
>   <map:match pattern="authenticate.xxx">
>     <map:generate src="somedir/test.xml" />
>     <map:serialize type="xml" />
>   </map:match>
> If this works (it must!) there are only three possibilities left (that I
> can think of):
> - the extra match <map:match type="request-parameter" pattern="userid"> is
> wrong
> - something in authenticate.xsl
> - something fishy in the XML produced by the XML database.
> I've never worked with XML databases, so I can't help you there.
> 
> Best of luck,
> Peter
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


-- 
Andre H. Juffer              | Phone: +358-8-553 1161
The Biocenter and            | Fax: +358-8-553-1141
     the Dep. of Biochemistry | Email: Andre.Juffer@oulu.fi
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/

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