authentication fw: flowscript in authentication resource

2003-05-31 Thread Hugo Burm
Hello

I am trying to use flowscript in the authentication resource of the
authentication framework.
authuser is my authentication resource. 

Part of sitemap:
 !-- call flowscript --
 map:match pattern=authuser
map:call function=auth/
 /map:match
 !-- called by sendPage --
 map:match pattern=userID
map:generate src=userID.xml /
map:serialize type = xml /
 /map:match

This is the flowscript function:
function auth() {
  sendPage(userID, {user : test} );
 }
 
And this is the userID xml file called by sendPage:
?xml version=1.0?
authentication
ID23/ID
datanamehugob/name/data
/authentication

When I call the resource directly by appname/authuser, the sitemap matches
the authusr and the flowscript returns the content of the xml file as
expected.  When I use it as an authentication resource, I get a null pointer
exception.
This is from core.log:
at
org.apache.cocoon.webapps.authentication.components.Authenticator.authentica
te(Authenticator.java:187)
... 61 more
org.apache.cocoon.ProcessingException: Attempted to process incomplete
pipeline.
at
org.apache.cocoon.components.source.impl.SitemapSource.init(SitemapSource.ja
va:377)

When I use userID as my authentication resource (and skip the flowscript
step), authentication works OK.

What is going wrong? Is it just impossible to use flowscript in this
resource?

attachment: winmail.dat-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Authentication Resource

2002-11-05 Thread Senhaji
Hi all,

I am trying to protect my pages by using the Authentication framework. The
authentication resource uses XSP to access the datastore. I've tried almost
everything but I didn't succeed to retrieve the auth-login action parameters
({request:...}) from within the XSP code to complete the select statement.

Here is the XSP code.
=

xsp:page language=java
  xmlns:xsp=http://apache.org/xsp;
  xmlns:esql=http://apache.org/cocoon/SQL/v2;
  xmlns:xsp-request=http://apache.org/xsp/request/2.0;


  page

   content
xsp:logic
  String userName = xsp-request:get-parameter name=name/;
  String password = xsp-request:get-parameter name=password/;
/xsp:logic

esql:connection
esql:poolportal/esql:pool
esql:execute-query

   esql:query
SELECT id,password,color from PORTALUSER_TABLE where id =
'$userName'
   /esql:query

   esql:results
 esql:row-results
   authentication
ID
esql:get-string column=id/
/ID
color
esql:get-string column=color/
/color
/authentication
 /esql:row-results
   /esql:results

 /esql:execute-query
/esql:connection

   /content

  /page
/xsp:page

Any help

Thanks


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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




Re: Authentication Resource

2002-11-05 Thread Markdelanoy
You've got the XSP but what does the sitemap look like??

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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




RE: Authentication Resource

2002-11-05 Thread Senhaji
the sitemap looks like this :

***
* The auth-login action
***
map:match pattern=loginProcess
!-- try to login --
map:act type=auth-login
map:parameter name=handler value=authHandler/
  map:parameter name=parameter_name   value={request:username}/
  map:parameter name=parameter_pass   value={request:password}/

  map:redirect-to uri=myProtectedPage/=

/map:act
!-- try it again --
map:redirect-to uri=login/
/map:match

***
Protected page
***
map:match pattern=myProtectedPage
map:act type=auth-protect
map:parameter name=handler value=authHandler/
  map:generate src=docs/protected.xml/
map:transform src=stylesheets/simple-page2html.xsl/
  map:serialize/

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

*
* The authenticate resource
*
map:pipeline internal-only=true
!-- This is the authentication respource --
map:match pattern=authenticate
map:generate src=resources/authentication.xsp
type=serverpages/
map:transform src=stylesheets/authenticate.xsl/
  map:serialize type=xml/
/map:match
/map:pipeline

Thanks for your help


-Message d'origine-
De : [EMAIL PROTECTED] [mailto:Markdelanoy;aol.com]
Envoyé : mardi 5 novembre 2002 15:50
À : [EMAIL PROTECTED]
Objet : Re: Authentication Resource


You've got the XSP but what does the sitemap look like??

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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




Re: Authentication Resource

2002-11-05 Thread Markdelanoy
You'll need to confirm this but look in cocoon's sitemap.log.  You should see the 
pipeline parameters being passed around.

in the sitemap your passing cocoon parameters but in the XSP your looking in the HTTP 
request.  Try looking in the parameters, e.g. parameters.getParameter( name ); 
parameters.getParameter( pass );

the names of the username password duo are the same spelling as in the sitemap.

also make sure your login page widget id/name s are the same as request:.. in the 
sitemap and then look for cocoon parameters named the same as the sitemap instead of 
http request parameters named as you have in your login page.

so try that.

md

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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




RE: Authentication Resource

2002-11-05 Thread Senhaji
Thanks Mark I'll try this. I didn't try the getParameter method yet

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:Markdelanoy;aol.com]
Envoyé : mardi 5 novembre 2002 16:20
À : [EMAIL PROTECTED]
Objet : Re: Authentication Resource


You'll need to confirm this but look in cocoon's sitemap.log.  You should
see the pipeline parameters being passed around.

in the sitemap your passing cocoon parameters but in the XSP your looking in
the HTTP request.  Try looking in the parameters, e.g.
parameters.getParameter( name ); parameters.getParameter( pass );

the names of the username password duo are the same spelling as in the
sitemap.

also make sure your login page widget id/name s are the same as request:..
in the sitemap and then look for cocoon parameters named the same as the
sitemap instead of http request parameters named as you have in your login
page.

so try that.

md

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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




RE: Authentication Resource

2002-11-05 Thread Senhaji
I get it. You should use request.getParameter(user) rather than
parameters.getParameter(user) in your XSP server page to access the user
information.

Below the XSP code that works

xsp:page language=java
  xmlns:xsp=http://apache.org/xsp;
  xmlns:esql=http://apache.org/cocoon/SQL/v2;
  xmlns:log=http://apache.org/xsp/log/2.0;
  xmlns:xsp-request=http://apache.org/xsp/request/2.0;

xsp:structure

xsp:includeorg.apache.avalon.framework.parameters.ParameterException/xsp:
include
/xsp:structure

xsp:logic

private  String getUserName ()  {
try {
return request.getParameter(myName);
}catch (ParameterException pe) {
return x ;
}
}

private  String getPassword ()  {
try {
return request.getParameter(myPass);
}catch (ParameterException pe) {
return x ;
}
}

/xsp:logic

  page
   log:debugProcessing the beginning of the authentication page
/log:debug

   content

esql:connection
 esql:poolportal/esql:pool
 esql:execute-query

   esql:query
SELECT id,password,color from PORTALUSER_TABLE where id =
'xsp:exprgetUserName()/xsp:expr' and password =
'xsp:exprgetPassword()/xsp:expr'
   /esql:query

   esql:results
 esql:row-results
   authentication
ID
esql:get-string column=id/
/ID
color
esql:get-string column=color/
/color
userName
xsp:logic
getLogger().debug(UserName:: + getUserName() +  password:: 
+
getPassword());
/xsp:logic
/userName
/authentication
 /esql:row-results
   /esql:results

 /esql:execute-query
/esql:connection

   /content
log:debugProcessing the end of the page/log:debug
  /page
/xsp:page

Enjoy

Senhaji

-Message d'origine-
De : Senhaji [mailto:osenhaji;wanadoo.fr]
Envoyé : mardi 5 novembre 2002 16:55
À : [EMAIL PROTECTED]
Objet : RE: Authentication Resource


Thanks Mark I'll try this. I didn't try the getParameter method yet

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:Markdelanoy;aol.com]
Envoyé : mardi 5 novembre 2002 16:20
À : [EMAIL PROTECTED]
Objet : Re: Authentication Resource


You'll need to confirm this but look in cocoon's sitemap.log.  You should
see the pipeline parameters being passed around.

in the sitemap your passing cocoon parameters but in the XSP your looking in
the HTTP request.  Try looking in the parameters, e.g.
parameters.getParameter( name ); parameters.getParameter( pass );

the names of the username password duo are the same spelling as in the
sitemap.

also make sure your login page widget id/name s are the same as request:..
in the sitemap and then look for cocoon parameters named the same as the
sitemap instead of http request parameters named as you have in your login
page.

so try that.

md

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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