Basic authentication with the JDBC realm in GlassFish

We will make some changes to the tags we added to configure security in the Protecting access to folders in web applications section. Here are the changes:

  1. Rename role-name from admin to admin-role
  2. Remove the <security-role> tag
  3. Add the <login-config> tag

Here is what the changed declaration should look like:

<security-constraint>    <display-name>Admin resources</display-name>    <web-resource-collection>        <web-resource-name>admins</web-resource-name>        <url-pattern>/admin/*</url-pattern>    </web-resource-collection>    <auth-constraint>        <role-name>admin-role</role-name>    </auth-constraint></security-constraint><login-config>    <auth-method>BASIC</auth-method> <realm-name>courseManagementJDBCRealm</realm-name> ...

Get Java EE 8 Development with Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.