Hi Denny,


U hav to use request.isUserInRole("Denny") to compare whether the user
logged in is Denny or not



Joby.



-----Original Message-----
From: Mario Winterer [mailto:[EMAIL PROTECTED]
Sent: Friday, February 04, 2005 3:13 AM
To: Tomcat Users List
Subject: Re: isUserInRole question



Hi Denny!



Which Realm do you use in server.xml? What are your web.xml-settings?

Please post your configurations!!!



  Tex



>Hello,

>Thanks for your reply.  When I use IE to bring up the

>page I get a dialogbox asking for user name and

>password.  If I put in a user name and password of a

>user on the workstation I can login.  The page shows

>the correct user name and says that I have

>successfully logged in.  But I get 2 false for the

>isUserInRole statements.  I don't know why that is the

>case.

>

>Thanks.

>

>

> 

>

>>---------------------------------------------------------------------

>>   

>>

>Hi!

>

>I'm not sure, but I think your code is OK. The

>question is: How did you

>configure your security realm in web.xml and

>server.xml.

>(request.isUserInRole only works, if the user has

>already been

>authenticated against the web server.)

>

>Best regards,

>  Tex

>

> 

>

>>Hello,

>>I am trying to use isUserInRole in an app within

>>Tomcat.  The problem is that I consistently get false

>>as the return regardless of what I pass in.  I am

>>using J2SE 1.4.2_06 and Tomcat 5.0.  Here is the code

>>and any help would be great:

>>

>>import java.io.*;

>>import javax.servlet.*;

>>import javax.servlet.http.*;

>>

>>public class NtlmHttpAuthExample extends HttpServlet

>>   

>>

>{

> 

>

>>   public void doGet( HttpServletRequest req,

>>               HttpServletResponse resp ) throws

>>IOException, ServletException {

>>       PrintWriter out = resp.getWriter();

>>

>>       resp.setContentType( "text/html" );

>>       out.println( "<HTML><HEAD><TITLE>NTLM HTTP

>>Authentication Example</TITLE></HEAD><BODY>" );

>>       out.println( "<h2>NTLM HTTP Authentication

>>Example</h2>" );

>>

>>       out.println( req.getRemoteUser() + "

>>successfully logged in" );

>>

>>

>>    out.println(req.isUserInRole("admin"));

>>

>>

>>    out.println("<br>-");

>>    out.println(req.isUserInRole("Administrators"));

>>

>>       out.println( "<h3>Please submit some form

>>   

>>

>data

> 

>

>>using POST</h3>" );

>>       out.println( "<form

>>action=\"NtlmHttpAuthExample\" method=\"post\">" );

>>       out.println( "<input type=\"text\"

>>name=\"field1\" size=\"20\"/>" );

>>       out.println( "<input type=\"submit\"/>" );

>>       out.println( "</form>" );

>>

>>       out.println( "field1 = " + req.getParameter(

>>"field1" ));

>>

>>       out.println( "</BODY></HTML>" );

>>   }

>>   public void doPost( HttpServletRequest req,

>>               HttpServletResponse resp ) throws

>>IOException, ServletException {

>>       doGet( req, resp );

>>   }

>>}

>>

>>

>>

>>

>>

>>---------------------------------------------------------------------

>>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]







Confidentiality Notice

The information contained in this electronic message and any attachments to 
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or 
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.

Reply via email to