O'Reilly logo

Spring Security 3.x Cookbook by Anjana Mankale

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Spring Security with Hibernate using authentication provider with @preAuthorize annotation

We are using the sample horrormovie application to demonstrate Spring Security with Hibernate using custom authentication provider and @preAuthorize annotation.

In this recipe we will create our own custom authentication provider and implement the interface authentication provider. We will apply the annotation on the controller method instead of the hibernate method.

Getting ready

  • Create a new class which implements the AuthenticationProvider interface and add the Bean definition to the application-security.xml file
  • Edit the application-security.xml file
  • Use the @preAuthorize annotation in controller

How to do it...

The following steps are used to implement Spring ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required