Identity stores provide access to a persistence storage system, such as a relational or LDAP (Lightweight Directory Access Protocol) database, where user credentials are stored. The Java EE Security API supports relational and LDAP databases directly, and it allows us to integrate with custom identity stores, if necessary.
To authenticate a secured resource, such as a Servlet or JAX-RS RESTful web service, against credentials stored in a relational database, we need to annotate an application-scoped CDI bean with the @DatabaseIdentityStoreDefinition
annotation, as illustrated in the following example.
package net.ensode.javaee8book.httpauthdatabaseidentitystore.security;
import javax.enterprise.context.ApplicationScoped;
import javax.security.enterprise.identitystore.DatabaseIdentityStoreDefinition;
@DatabaseIdentityStoreDefinition(
dataSourceLookup = "jdbc/userAuth",
callerQuery = "select...