I'm having trouble getting BASIC authentication to work with Glassfish. I am developing an application and I need to provide a username and password. I received the application to ask me for the password when trying to access the application, but after entering the correct login information I get HTTP Status 403 - Access to the requested resource has been denied.
I went into the Glassfish Admin Console and created some sample users in the area fileand enabled Security Manager.
Then, in my web.xmlfile, I added the following:
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure Application</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>User</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>file</realm-name>
</login-config>
<security-role>
<role-name>User</role-name>
</security-role>
, . . , , , , , .
, Glassfish Open Source 3.0.1 Netbeans 6.9 .