O'Reilly logo

Spring Security - Third Edition by Peter Mularien, Robert Winch, Mick Knutson

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

JPA-based PersistentTokenRepository

As we have seen in the earlier chapters, using a Spring Data project for our database mapping can greatly simplify our work. So, to keep things consistent, we are going to refactor our JDBC-based PersistentTokenRepository interface that uses JdbcTokenRepositoryImpl to one that is JPA-based. We will do so by performing the following steps:

  1. First, let's create a domain object to hold the persistent logins, as shown in the following code snippet:
        //src/main/java/com/packtpub/springsecurity/domain/        PersistentLogin.java         import org.springframework.security.web.authentication.rememberme.        PersistentRememberMeToken;        import javax.persistence.*;        import java.io.Serializable;        import java.util.Date;        @Entity @Table(name ...

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