users@glassfish.java.net

Suppress WWW-Authenticate header if Basic Auth fails

From: <forums_at_java.net>
Date: Thu, 20 Oct 2011 11:04:59 -0500 (CDT)

I have configured a JAX-RS service to authenticate using Basic Auth. For this
I have set up a jdbcRealm in GlassFish. The HTML/JavaScript client is
configured to send an Authorization header with every AJAX request. If the
header contains valid credentials there are no issues. However if the
credentials are not valid, GlassFish returns a WWW-Authenticate header with
an error code of 401 (Unauthorized). Unfortunately the WWW-Authenticate
header is causing the browser to pop up an ugly authentication dialog box
instead of letting the JavaScript client handle the 401 error. Is there any
way to configure the GlassFish realm to not send theĀ WWW-Authenticate header
when authentication fails? Just the 401 error is good enough for me.

Naresh


--
[Message sent by forum member 'nbhatia']
View Post: http://forums.java.net/node/855465