Another way we can authenticate users in our application is to use a custom form authentication mechanism; this type of authentication mechanism is useful when we want to integrate our application with a web framework, such as JSF. In our next example, we will illustrate how to do just that, integrating the Java EE Security API with JSF, via custom form authentication.
To use custom form authentication in our applications, we need to use the aptly named @CustomFormAuthenticationMechanismDefinition annotation, as illustrated in the following example:
package net.ensode.javaee8book.httpauthdbidentitystore; import java.io.IOException; import javax.annotation.security.DeclareRoles; import javax.security.enterprise.authentication.mechanism.http.CustomFormAuthenticationMechanismDefinition; ...