You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mike Dickson <mi...@yahoo.com> on 2005/11/18 01:13:43 UTC

Security and Authentication

I am using Tomcat Form-based authentication.  The user docs ask you to name
your form fields, j_username and j_password.  Then you POST to
j_security_check.  Everything is working and I get a JSESSIONID and am
forwarded to my protected user home page.  

 

Question:  What data does Tomcat forward to the protected user home page so
I can tell which user has just logged in? I need to look up their data and
have it ready for the user home page.  What variables are there to work
with?  JSESSIONID that's it?  How about the j_username so I can use that to
make a page for that individual user?

 

Mike D.


Re: Security and Authentication

Posted by B Wiley Snyder <wi...@gmail.com>.
try this ...

java.security.Principal



Principal pri;
pri = request.getUserPrincipal();

that's the only way I know of, unless you use some javascript to save the 
login in the session on the form ...



-Wiley





java.security.PiAt 04:13 PM 11/17/2005, you wrote:
>I am using Tomcat Form-based authentication.  The user docs ask you to name
>your form fields, j_username and j_password.  Then you POST to
>j_security_check.  Everything is working and I get a JSESSIONID and am
>forwarded to my protected user home page.
>
>
>
>Question:  What data does Tomcat forward to the protected user home page so
>I can tell which user has just logged in? I need to look up their data and
>have it ready for the user home page.  What variables are there to work
>with?  JSESSIONID that's it?  How about the j_username so I can use that to
>make a page for that individual user?
>
>
>
>Mike D.


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


RE: Security and Authentication

Posted by Mike Dickson <mi...@yahoo.com>.
{request:remoteUser} worked!  I thank you for your time.

 

For the record:

              <map:match pattern="user/home">

                    <map:generate src="transform/user/home.xml"/>

                    <map:transform src="transform/user/home.xsl">

                        <map:parameter name="use-request-parameters"
value="true"/>

                        <map:parameter name="use-session-info"
value="true"/>

                        <map:parameter name="remoteUser"
value="{request:remoteUser}"/>                          

                    </map:transform>

                    <map:transform type="encodeURL"/>

                    <map:serialize type="html"/>

              </map:match>        

 

One note:  I have spent three days looking around the Internet to solve
this.  I am sure many people need to know the answer to this question.  I
hope someone that has control of the docs can add something.  Otherwise,
this post may help out.

 

Mike D.

 

-----Original Message-----
From: Andrew Stevens [mailto:ats37@hotmail.com] 
Sent: Thursday, November 17, 2005 4:17 PM
To: mikedickson@yahoo.com; users@cocoon.apache.org
Subject: RE: Security and Authentication

 

>From: "Mike Dickson" <mi...@yahoo.com>

>Date: Thu, 17 Nov 2005 12:31:35 -0800

> 

>What data does Tomcat forward to Cocoon so I can tell which user has just

>logged in? I need to look up their data and have it ready for the user home

>page.  (What variables are handed to Cocoon to work with?  JSESSIONID?  How

>do I get at them? {request-param:..}?)

 

I haven't checked what's currently available in CVS, but in one of our 

projects a while back I just modified the request parameter action (I think)


to put the getRemoteUser() value in an extra entry in the returned map.  

Then I just used that in the sitemap with {remoteUser}.

Another possibility (for which I submitted a patch - #35051 in bugzilla) is 

to add it to the request generator output.  I have a vague feeling you can 

also access it with the request input module ({request:remoteUser} maybe?) 

though I might be wrong about that.

 

There's also a patch in bugzilla (#32164) that fixes the broken 

RoleFilterTransformer, so you can make use of isUserInRole() privileges.

 

 

Andrew.

 

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org

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


RE: Security and Authentication

Posted by Andrew Stevens <at...@hotmail.com>.
>From: "Mike Dickson" <mi...@yahoo.com>
>Date: Thu, 17 Nov 2005 12:31:35 -0800
>
>What data does Tomcat forward to Cocoon so I can tell which user has just
>logged in? I need to look up their data and have it ready for the user home
>page.  (What variables are handed to Cocoon to work with?  JSESSIONID?  How
>do I get at them? {request-param:..}?)

I haven't checked what's currently available in CVS, but in one of our 
projects a while back I just modified the request parameter action (I think) 
to put the getRemoteUser() value in an extra entry in the returned map.  
Then I just used that in the sitemap with {remoteUser}.
Another possibility (for which I submitted a patch - #35051 in bugzilla) is 
to add it to the request generator output.  I have a vague feeling you can 
also access it with the request input module ({request:remoteUser} maybe?) 
though I might be wrong about that.

There's also a patch in bugzilla (#32164) that fixes the broken 
RoleFilterTransformer, so you can make use of isUserInRole() privileges.


Andrew.



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