cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ternes, Oliver" <oliver.ter...@iwka.de>
Subject Authentication: XSP & Database
Date Thu, 12 Jun 2003 11:32:25 GMT
Hi everyone,

I have problems using the authentication framework and session management. I
read the user documentation thousand times and I tried to modify the Portal
framework to suit my needs, but it doesn't work at all.
Well, I want to create a login using a database. I need to retrieve the
rights connected to a user and his role. I wrote a XSP to get that data, it
looks like this: 

<?xml version="1.0" encoding="ISO-8859-1"?>
<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"
xmlns:xsp-session="http://apache.org/xsp/session/2.0"
create-session="true">

<authentication>
   <xsp:logic>
      String userName = <xsp-request:get-parameter name="userName" />;
      String userPass = <xsp-request:get-parameter name="userPW" />;
      String userRole = <xsp-request:get-parameter name="userRole" />;
      <esql:connection>
	<esql:pool>AutOIPS</esql:pool>
		<esql:execute-query>
			<esql:query>
				...
			</esql:query>
		<esql:results>
	<esql:row-results>
	<ID><esql:get-int column="userID" /></ID>
	<role><xsp-request:get-parameter name="userRole" /></role>
		<data>
			<xsp:logic>if (
				<esql:get-string
column="rightName"/>.equals("read")) {
			</xsp:logic>
				<read>read</read>
			<xsp:logic>
				}if (<esql:get-string
column="rightName"/>.equals("execute"))
			{</xsp:logic>
				<exec>execute</exec>
			<xsp:logic>}</xsp:logic>
		</data>
	</esql:row-results>
...
	  </authentication>
</xsp:page>

I also get the data but how can I transform them into a valid session
object? I adapted my sitemap like it is shown in the cocoon documentation,
but it doesn't work - here's the extract:

    <map:match pattern="login*">
    	<map:act type="auth-loggedIn">
   		<map:parameter name="handler" value="iwkahandler" />
	        	<map:redirect-to uri="projects/index.xml"/>
	</map:act>
        	<map:act type="auth-login">
  		<map:parameter name="handler" value="iwkahandler" />
        		<map:parameter name="parameter_userName"
value="{request:userName}" />
        		<map:parameter name="parameter_userPW"
value="{request:userPW}" />
        		<map:parameter name="parameter_userRole"
value="{request:userRole}" />
	        	<map:redirect-to uri="projects/index.xml"/>
        	</map:act>
        	<map:generate src="login.xml"/>
        	<map:transform src="styles/login-html.xsl"/>
        	<map:transform type="encodeURL"/>
        	<map:serialize/>
    </map:match>

    <map:match pattern="**/logon.xsp">
	    	<map:generate type="serverpages" src="xsp/logon.xsp" />
        		<map:transform type="session"/>
	    	<map:serialize type="xml"/>
    </map:match>

I hope you can help me ... 

Some more technical data:
	Win2k SP3, Cocoon 2.1 within the jetty container, Internet Explorer
6.0

Thanks
Oliver
	

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


Mime
View raw message