The JAAS authentication module is required to authenticate the user, defining principles that may include mapping users / managers existing in the database to roles defined in the source code.
Assuming you are using GlassFish v3 for Java EE 6, you need to create and configure a JDBC scope in GlassFish for this purpose. Be warned that the area configuration may not have a one-to-one mapping with the user table in your database, in which case you need to either modify the table definition or expand the entry module to create your own schema.
Despite setting up the database scope, you still need to map the Java EE roles defined in your source code to the actual roles in the scope. This is done using deployment descriptors for a specific application server.
source share