Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. //this line added to HttpSecurity object
  2. .and().rememberMe().rememberMeParameter("rememberMe")
  3. .tokenRepository(persistentTokenRepository())
  4. .tokenValiditySeconds(86400)
  5.  
  6. @Bean
  7. public DataSource getDataSource() {
  8. DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
  9. dataSourceBuilder.driverClassName("${db.driver}");
  10. dataSourceBuilder.url("${db.url}");
  11. dataSourceBuilder.username("${db.username}");
  12. dataSourceBuilder.password("${db.password}");
  13. return dataSourceBuilder.build();
  14. }
  15.  
  16. @Bean
  17. public PersistentTokenRepository persistentTokenRepository() {
  18. JdbcTokenRepositoryImpl jdbcTokenRepository = new JdbcTokenRepositoryImpl();
  19. jdbcTokenRepository.setDataSource(getDataSource());
  20. return jdbcTokenRepository;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement