To use Java EE authentication information for JPA Security you may integrate JPA Security like described in the previous chapter and specify as authentication provider in your persistence properties. You need to define all the roles your application is using with the @DeclareRoles annotation at at least one of your entity beans in order to make the EjbAuthenticationProvider work correctly.

If you do not have a version of a spring-security.jar in your classpath usually you do not need to define your own authentication provider as the auto-detection mechanism of JPA Security should automatically install the EjbAuthenticationProvider.