Thanks guys, I got it...

----- Original Message -----
From: "Giselle Dazzi" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, November 04, 2003 10:29 PM
Subject: Re: security-constraint question


> Im having a hard time calling those methods, I guess I need to create an
> object, does anyone have a sample code ? Here's what Im getting now:
>
>
F:\jakarta-tomcat-4.1.27\work\Standalone\localhost\locadora\menu_jsp.java:58
> : non-static method getUserPrincipal() cannot be referenced from a static
> context
>  java.security.Principal usuarioPrincipal =
> HttpServletRequestWrapper.getUserPrincipal();
>
> I guess I need to create a HttpServletRequestWrapper object, but the
> constructor expects a ServletRequest request, and Im kind of lost what
that
> would be....
>
>
>
> ----- Original Message -----
> From: "Christopher Schultz" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Sent: Tuesday, November 04, 2003 8:58 PM
> Subject: Re: security-constraint question
>
>
> > Giselle,
> > > Im using the <security-constraint> feature of Tomcat. Everything
> > > works well, but I dont know how to retrieve the login entered during
> > > authentication to use it throughout my application... Have you guys
> > > done this before ?
> >
> > What you want is request.getUserPrincipal(). This will return a
> > java.security.Principal object. You can get the name by calling
> > getName() on that object.
> >
> > Unfortunately, you can't get the role or roles for the user. You have to
> > know the roles beforehand and then use request.isUserInRole to determine
> > wether they are or are not in a given role. :(
> >
> > -chris
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



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

Reply via email to