Custom form authentication mechanism

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; ...

Get Java EE 8 Application Development 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.