Note that there are some explanatory texts on larger screens.

plurals
  1. POBasic Authentication in Glassfish
    text
    copied!<p>I am having trouble getting BASIC authentication to work with Glassfish. I am developing an application and I need to be prompted for a username and password. I have gotten the application to prompt me for a password when I attempt to access the application, but after entering the correct login information, I get <code>HTTP Status 403 - Access to the requested resource has been denied</code>.</p> <p>I have gone into the Glassfish Admin Console and created a few sample users in the <code>file</code> realm and enabled the Security Manager. </p> <p>Next, in my <code>web.xml</code> file, I have added the following:</p> <pre><code>&lt;security-constraint&gt; &lt;web-resource-collection&gt; &lt;web-resource-name&gt;Secure Application&lt;/web-resource-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;http-method&gt;GET&lt;/http-method&gt; &lt;http-method&gt;POST&lt;/http-method&gt; &lt;/web-resource-collection&gt; &lt;auth-constraint&gt; &lt;role-name&gt;User&lt;/role-name&gt; &lt;/auth-constraint&gt; &lt;/security-constraint&gt; &lt;login-config&gt; &lt;auth-method&gt;BASIC&lt;/auth-method&gt; &lt;realm-name&gt;file&lt;/realm-name&gt; &lt;/login-config&gt; &lt;security-role&gt; &lt;role-name&gt;User&lt;/role-name&gt; &lt;/security-role&gt; </code></pre> <p>I'm not exactly sure what to do next. I have searched for several hours with no luck. The authentication works because if I enter incorrect login information, it prompts again, but after successfully authenticating, I get the access denied message shown above.</p> <p>If it helps, I am running Glassfish Open Source 3.0.1 and using Netbeans 6.9 for development.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload