You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Philipp Bornheimer <li...@phibo.eu> on 2009/11/18 15:36:53 UTC

Custom error-page for HTTP error 401 with basic authentication

Hi folks,

I'm trying to configure a custom error page for the HTTP error 401 
(authentication failed).
See appenix for my web.xml. Without the error-page-Tag everything works 
fine. This means
that an authentication window pops up. The HTTP response containt the 
following line:

WWW-Authenticate: Basic realm="hostname:port"

If I press cancel or fail to provide the correct credentials, there will 
be a redirect to the 401 error-page.

With the error-page-Tag included in the web.xml, the given page 
error/error.html is presented to the
client without pop up. No WWW-Authenticate attribute is included in the 
HTTP response.

I appreciate any help. :-)

Philipp

web.xml:
<web-app>
    <display-name>xxx</display-name>
    <context-param>
        <param-name>tapestry.app-package</param-name>
        <param-value>xxx</param-value>
    </context-param>
    <filter>
        <filter-name>app</filter-name>
        <filter-class>org.apache.tapestry5.TapestryFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>app</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
   
    <error-page>
        <error-code>401</error-code>
        <location>/error/error.html</location>
    </error-page>
   
    <security-constraint>
         <web-resource-collection>
        <web-resource-name>All resources</web-resource-name>
        <description>Protects all resources</description>
        <url-pattern>/*</url-pattern>
     </web-resource-collection>
     <auth-constraint>
        <role-name>user</role-name>
     </auth-constraint>
    </security-constraint>
    <login-config>
        <auth-method>BASIC</auth-method>
    </login-config>
    <security-role>
        <role-name>user</role-name>
    </security-role>
</web-app>

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


Re: Custom error-page for HTTP error 401 with basic authentication

Posted by KidTab <ki...@gmail.com>.
The trouble come from you configuration file (web.xml) just change the
managed error code 401 with 403 for more information about it just check the
HTTP protocol specification ( the 401 manages access of a section, the 403
manages the authorisation)


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Custom-error-page-for-HTTP-error-401-with-basic-authentication-tp2421869p4461144.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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