I'm using the authentication framework too, but to get something from the session, I use session-fw:
 
 
<xsp:logic>
String roleFrag = <xsp-session-fw:getxml as="string" context="authentication" path="/authentication/role"/>;
DocumentFragment nameFragment = (DocumentFragment)<xsp-session-fw:getxml as="object" context="authentication" path="/authentication/data/name"/>;
 
String name = new String();
for(int i = 0; i&lt; nameFragment.getChildNodes().getLength(); i++){
    nameString.append(nameFragment.getChildNodes().item(i).getNodeValue());
}
</xsp:logic>
 
 
I use < .. as="object" ..> in the second variable because when I started using this, the <.. as="string" > only returned the first text node although the real text in an element may be split up in different text nodes. That's also why I have that for loop to append each text node to the string to obtain the full text. It's possible that this has been changed in the cvs head as I did mail it on this list and there was some response by the developer(s) of that logicsheet.
 
Kind Regards,
Jan
----- Original Message -----
Sent: Sunday, May 16, 2004 7:53 PM
Subject: Getting additional user's information from session object (authentication framework problem)

Hi
I'd like to keep in session some additional information about users. My sunrise-user.xml file looks like this:
 
*************************sunrise_user.xml ******************
<authentication>
 <users>  
  <user>
   <name>cocoon</name>
   <password>cocoon</password>
   <role>cocoon</role>
   <data>    
    <name>hello</name>
    <age>12</age>
   </data>   
  </user>  
 </users>
</authentication>
**********************************************
 
I have no problem with getting ID, and role content, but when I use session transformer to get name or age I get this result:
 
************ session transformer result *****
<authentication>
<ID>cocoon</ID>
<role>cocoon</role>
<data>
<user>cocoon</user>
</data>
<type>cocoon.authentication</type>
<media>html</media>
</authentication>
<application>
*************************************************
As you can see my <data></data> elements, hasn't got <name> and <age> children... why ?????
 
This is part of my_session_view.xsp file:
 
*******************my_session_view.xsp *******************************
<session:getxml context="authentication" path="/"/>
<session:getxml context="authentication" path="/authentication/data/name"/>  
 
****************************************************************************
 
At the sitemap's level I have tried to do it in this way (but every time I get nothing). My pipeline is auth-protect:
 
************************ sitemap *************************
<map:transform src="">
     <parameter name="user" value="{/authentication/data/name}"/>
</map:transform>
************************************************************
 
What I'm doing wrong ? How can I get access to this additional data in xsp file, and in sitemap (I need them in sitemap too :( ) ?????
 
 
greeting
mario
 

Reply via email to