Hi,
You get it right.
pac4j is a generic security engine available via its pac4j-core module which is multi authentication mechanisms and frameworks.
Various authentication mechanisms are available through pac4j-* module: pac4j-oauth for OAuth (Facebook, Twitter...), pac4j-ldap for LDAP authentication...
Various framework implementations are available through *-pac4j projects: j2e-pac4j for J2E, play-pac4j for Play, vertx-pac4j for Vertx...
Indirect clients are authentication mechanisms where the user is redirected to an external identity provider (form authentication is considered so) while direct clients are used when credentials are passed directly along the HTTP request (web services).
As your dropwizard app is a J2E webapp, you can use the j2e-pac4j library to handle the security:
- the RequiresAuthenticationFilter protects url
- the CallbackFilter is necessary for indirect client to finish the process.
So in your case, you need to define two clients: a FormClient (from the pac4j-http library) for form login with a specific UsernamePasswordAuthenticator which checks credentials in the database (you could maybe use the DbAuthenticator from the pac4j-sql module).
For the REST calls: what are the credentials and authentication mechanism?
For example, you could create a ParameterClient (if it's a token) or a DirectBasicAuthClient (if it's a login/pwd passed via basic auth).
Both clients will be gathered in a Config which itself will be built via a ConfigFactory, whose name must be specified in one of the filters.
The authorizers (like CustomAuthorizer) only deal with authorizations (like roles, permissions...) so I don't think need them in your case.
I hope it's clearer now.
Thanks.
Best regards,
Jérôme