You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dick Eastlake <di...@yahoo.com> on 2011/04/05 23:49:27 UTC

IE & Firefox work fine, Mac, Google and Safari don't authenticate

Users can authenticate to the secured area of my Website using IE and Firefox; no problem.  However,Macs, Google and Safari browsers cannot log in.

Macs, Google and Safari browsers go straight to the form-error-page "not_auth.html".

Please help!


I'm using a simple form-based authentication method.


Here's my WEB.XML (from inside the webapp, not the conf):

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
<display-name>Progressive Commerce Inc</display-name>

<description>
    Progressive Website
</description>

<security-constraint>
    <display-name>Progressive Security
 Constraint</display-name>
    <web-resource-collection>
        <web-resource-name>Dealer Area</web-resource-name>
        <url-pattern>/catalog/dealer/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>dealer</role-name>
    </auth-constraint>
</security-constraint>
<security-role>
    <role-name>dealer</role-name>
</security-role>

<security-constraint>
    <display-name>Joe Parts Security Constraint</display-name>
    <web-resource-collection>
        <web-resource-name>Joe Parts
 Area</web-resource-name>
        <url-pattern>/joeparts/admin/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>joe</role-name>
    </auth-constraint>
</security-constraint>

<security-role>
    <role-name>joe</role-name>
</security-role>
 
<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>Progressive Form-Based Authentication Area</realm-name>
    <form-login-config>
        <form-login-page>/catalog/dealer_door.jsp</form-login-page>
       
 <form-error-page>/not_auth.html</form-error-page>
    </form-login-config>
</login-config>


<resource-ref>
      <description>
        jdbc/progressive
      </description>
      <res-ref-name>
        jdbc/progressive
      </res-ref-name>
      <res-type>
        javax.sql.DataSource
      </res-type>
      <res-auth>
        Container
      </res-auth>
      <res-sharing-scope>
        Shareable
     
 </res-sharing-scope>
</resource-ref>

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>
    
</web-app>

Here's the code from my jsp

     <jsp:useBean id="dlb" scope="session" class="com.dealer.beans.DealerBean"/>

    <body bgcolor="#222324" text="#000000">
        <form method="POST" action="<%= response.encodeURL("j_security_check") %>">
            <p>&nbsp;</p>
            <div align="center"> </div>
            <table width="431" border="0" cellspacing="0" cellpadding="0">
   
           <tr bgcolor="#FFFFFF"
                  <td>

                </td>
                <td>
                    <table>
                    <tr>
   
                     <td width="160"><font 
color="009999"><b><font face="Arial, Helvetica, 
sans-serif">Email    
Address:</font></b></font></td>
               
         <td width="147">
                              <input tabindex="1" type="text" name="j_username" value="
<%
                  out.print(dlb.getEmail() + "\"");
%>
                  >      </td>
                        <td width="49">&nbsp;</td>
                      </tr>
                      <tr bgcolor="#FFFFFF">   
             
                        <td width="160" 
height="20"><font color="009999"><b><font face="Arial,
 Helvetica, 
sans-serif">Password:</font></b></font></td>
                        <td width="147" height="20">
                          <input tabindex="2" type="password" name="j_password">
                        </td>
                      </tr>
   
                   <tr bgcolor="#FFFFFF">
                        <td width="37">&nbsp;</td>
                        <td width="38">&nbsp;</td>
                        <td width="160"></td>
                        <td width="147">
                              <div align="center">
           
                     <input tabindex="3" type="submit" value="Log In">
                              </div>
                        </td>
                        <td width="49">&nbsp;</td>
                      </tr>
                </table>
            </table>
        </form>
   
 </body>

Here's the access log  the entries at 15;34 are using Firefox,  the ones at 15:42 are Google's browser


69.207.4.57 - - [27/Mar/2011:15:34:16 -0700] "GET /Dynacorn/catalog/dealerwelcome.jsp HTTP/1.1" 200 1870
69.207.4.57 - - [27/Mar/2011:15:34:27 -0700] "POST /Dynacorn/catalog/authControl.jsp HTTP/1.1" 302 -
69.207.4.57 - - [27/Mar/2011:15:34:27 -0700] "GET /Dynacorn/catalog/dealer/dealerwelcome.jsp
 HTTP/1.1" 200 1893
69.207.4.57 - - [27/Mar/2011:15:34:30 -0700] "POST /Dynacorn/catalog/dealer/j_security_check HTTP/1.1" 302 -
69.207.4.57 - sor@sor.com [27/Mar/2011:15:34:30 -0700] "GET /Dynacorn/catalog/dealer/dealerwelcome.jsp HTTP/1.1" 500 2158
69.207.4.57 - - [27/Mar/2011:15:42:14 -0700] "GET /Dynacorn/catalog/dealerwelcome.jsp HTTP/1.1" 200 1870
69.207.4.57 - - [27/Mar/2011:15:42:20 -0700] "POST /Dynacorn/catalog/authControl.jsp HTTP/1.1" 302 -
69.207.4.57 - - [27/Mar/2011:15:42:20 -0700] "GET /Dynacorn/catalog/dealer/dealerwelcome.jsp HTTP/1.1" 200 1893
69.207.4.57 - - [27/Mar/2011:15:42:23 -0700] "POST /Dynacorn/catalog/dealer/j_security_check HTTP/1.1" 200 676
there are no more entries


Again, IE & Firefox work fine, Mac, Google and Safari don't.

Thanks for your help,
Dick

Re: IE & Firefox work fine, Mac, Google and Safari don't authenticate

Posted by André Warnier <aw...@ice-sa.com>.
Hi.

Since I doubt that many people here really feel like going through a bunch of lines of 
badly-formatted configuration, code and logs to figure out exactly what is wrong, I 
suggest that you search Google for
"tomcat form based authentication example" and use one of the numerous ones there as a 
reference.

There is something bizarre in your explanation and data however :

You say that the first part of the log is with Firefox, which works fine.
However, that part contains this line :

 > 69.207.4.57 - sor@sor.com [27/Mar/2011:15:34:30 -0700] "GET 
/Dynacorn/catalog/dealer/dealerwelcome.jsp HTTP/1.1" 500 2158

which shows a status code 500 (= "server error") returned by the server, while the part 
supposedly not working shows no such error.

Another bizarre part is this : the JSP document that you show, appears to be the login 
page, and it contains a <form> line like this :

 >         <form method="POST" action="<%= response.encodeURL("j_security_check") %>">

Yet, looking at the log, it does not seem that there is ever a POST to that URL.

It would look like there is some confusion about the basic way in which form 
authentication is supposed to work.  That's also why your best bet may be to re-read the 
on-line documentation, and try first with one of the examples you will find in Google.


Dick Eastlake wrote:
> Users can authenticate to the secured area of my Website using IE and Firefox; no problem.  However,Macs, Google and Safari browsers cannot log in.
> 
> Macs, Google and Safari browsers go straight to the form-error-page "not_auth.html".
> 
> Please help!
> 
> 
> I'm using a simple form-based authentication method.
> 
> 
> Here's my WEB.XML (from inside the webapp, not the conf):
> 
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>     version="2.4">
> <display-name>Progressive Commerce Inc</display-name>
> 
> <description>
>     Progressive Website
> </description>
> 
> <security-constraint>
>     <display-name>Progressive Security
>  Constraint</display-name>
>     <web-resource-collection>
>         <web-resource-name>Dealer Area</web-resource-name>
>         <url-pattern>/catalog/dealer/*</url-pattern>
>     </web-resource-collection>
>     <auth-constraint>
>         <role-name>dealer</role-name>
>     </auth-constraint>
> </security-constraint>
> <security-role>
>     <role-name>dealer</role-name>
> </security-role>
> 
> <security-constraint>
>     <display-name>Joe Parts Security Constraint</display-name>
>     <web-resource-collection>
>         <web-resource-name>Joe Parts
>  Area</web-resource-name>
>         <url-pattern>/joeparts/admin/*</url-pattern>
>     </web-resource-collection>
>     <auth-constraint>
>         <role-name>joe</role-name>
>     </auth-constraint>
> </security-constraint>
> 
> <security-role>
>     <role-name>joe</role-name>
> </security-role>
>  
> <login-config>
>     <auth-method>FORM</auth-method>
>     <realm-name>Progressive Form-Based Authentication Area</realm-name>
>     <form-login-config>
>         <form-login-page>/catalog/dealer_door.jsp</form-login-page>
>        
>  <form-error-page>/not_auth.html</form-error-page>
>     </form-login-config>
> </login-config>
> 
> 
> <resource-ref>
>       <description>
>         jdbc/progressive
>       </description>
>       <res-ref-name>
>         jdbc/progressive
>       </res-ref-name>
>       <res-type>
>         javax.sql.DataSource
>       </res-type>
>       <res-auth>
>         Container
>       </res-auth>
>       <res-sharing-scope>
>         Shareable
>      
>  </res-sharing-scope>
> </resource-ref>
> 
> <welcome-file-list>
>     <welcome-file>index.html</welcome-file>
> </welcome-file-list>
>     
> </web-app>
> 
> Here's the code from my jsp
> 
>      <jsp:useBean id="dlb" scope="session" class="com.dealer.beans.DealerBean"/>
> 
>     <body bgcolor="#222324" text="#000000">
>         <form method="POST" action="<%= response.encodeURL("j_security_check") %>">
>             <p>&nbsp;</p>
>             <div align="center"> </div>
>             <table width="431" border="0" cellspacing="0" cellpadding="0">
>    
>            <tr bgcolor="#FFFFFF"
>                   <td>
> 
>                 </td>
>                 <td>
>                     <table>
>                     <tr>
>    
>                      <td width="160"><font 
> color="009999"><b><font face="Arial, Helvetica, 
> sans-serif">Email    
> Address:</font></b></font></td>
>                
>          <td width="147">
>                               <input tabindex="1" type="text" name="j_username" value="
> <%
>                   out.print(dlb.getEmail() + "\"");
> %>
>                   >      </td>
>                         <td width="49">&nbsp;</td>
>                       </tr>
>                       <tr bgcolor="#FFFFFF">   
>              
>                         <td width="160" 
> height="20"><font color="009999"><b><font face="Arial,
>  Helvetica, 
> sans-serif">Password:</font></b></font></td>
>                         <td width="147" height="20">
>                           <input tabindex="2" type="password" name="j_password">
>                         </td>
>                       </tr>
>    
>                    <tr bgcolor="#FFFFFF">
>                         <td width="37">&nbsp;</td>
>                         <td width="38">&nbsp;</td>
>                         <td width="160"></td>
>                         <td width="147">
>                               <div align="center">
>            
>                      <input tabindex="3" type="submit" value="Log In">
>                               </div>
>                         </td>
>                         <td width="49">&nbsp;</td>
>                       </tr>
>                 </table>
>             </table>
>         </form>
>    
>  </body>
> 
> Here's the access log  the entries at 15;34 are using Firefox,  the ones at 15:42 are Google's browser
> 
> 
> 69.207.4.57 - - [27/Mar/2011:15:34:16 -0700] "GET /Dynacorn/catalog/dealerwelcome.jsp HTTP/1.1" 200 1870
> 69.207.4.57 - - [27/Mar/2011:15:34:27 -0700] "POST /Dynacorn/catalog/authControl.jsp HTTP/1.1" 302 -
> 69.207.4.57 - - [27/Mar/2011:15:34:27 -0700] "GET /Dynacorn/catalog/dealer/dealerwelcome.jsp
>  HTTP/1.1" 200 1893
> 69.207.4.57 - - [27/Mar/2011:15:34:30 -0700] "POST /Dynacorn/catalog/dealer/j_security_check HTTP/1.1" 302 -
> 69.207.4.57 - sor@sor.com [27/Mar/2011:15:34:30 -0700] "GET /Dynacorn/catalog/dealer/dealerwelcome.jsp HTTP/1.1" 500 2158
> 69.207.4.57 - - [27/Mar/2011:15:42:14 -0700] "GET /Dynacorn/catalog/dealerwelcome.jsp HTTP/1.1" 200 1870
> 69.207.4.57 - - [27/Mar/2011:15:42:20 -0700] "POST /Dynacorn/catalog/authControl.jsp HTTP/1.1" 302 -
> 69.207.4.57 - - [27/Mar/2011:15:42:20 -0700] "GET /Dynacorn/catalog/dealer/dealerwelcome.jsp HTTP/1.1" 200 1893
> 69.207.4.57 - - [27/Mar/2011:15:42:23 -0700] "POST /Dynacorn/catalog/dealer/j_security_check HTTP/1.1" 200 676
> there are no more entries
> 
> 
> Again, IE & Firefox work fine, Mac, Google and Safari don't.
> 
> Thanks for your help,
> Dick


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