/** * Used to store the persistent login tokens for a user. */ @Bean public PersistentTokenRepository persistentTokenRepository() { final JdbcTokenRepositoryImpl impl = new JdbcTokenRepositoryImpl(); impl.setDataSource(dataSource); return impl; }
@Override protected void customizeRememberMe(HttpSecurity http) throws Exception { UserDetailsService userDetailsService = lookup("userDetailsService"); PersistentTokenRepository persistentTokenRepository = lookup("persistentTokenRepository"); AbstractRememberMeServices rememberMeServices = lookup("rememberMeServices"); RememberMeAuthenticationFilter rememberMeAuthenticationFilter = lookup("rememberMeAuthenticationFilter"); http.rememberMe() .userDetailsService(userDetailsService) .tokenRepository(persistentTokenRepository) .rememberMeServices(rememberMeServices) .key(rememberMeServices.getKey()) .and() .logout() .logoutUrl(LOGOUT_ENDPOINT) .and() .addFilterAt(rememberMeAuthenticationFilter, RememberMeAuthenticationFilter.class); }
/** * Persistent token repository persistent token repository. * * @return the persistent token repository */ @Bean public PersistentTokenRepository persistentTokenRepository() { JdbcTokenRepositoryImpl jdbcTokenRepository = new JdbcTokenRepositoryImpl(); jdbcTokenRepository.setDataSource(dataSource); return jdbcTokenRepository; }
@Bean public RememberMeServices rememberMeServices( UserDetailsService userDetailsService, PersistentTokenRepository persistentTokenRepository) { String secretKey = getRememberMeTokenSecretKey().orElseThrow(IllegalStateException::new); return new PersistentJwtTokenBasedRememberMeServices( secretKey, userDetailsService, persistentTokenRepository); }
@Bean public PersistentTokenRepository persistentTokenRepository() { JdbcTokenRepositoryImpl db = new JdbcTokenRepositoryImpl(); db.setDataSource(dataSource); return db; }
@Bean public PersistentTokenRepository persistentTokenRepository(JdbcTemplate jdbcTemplate) { JdbcTokenRepositoryImpl jdbcTokenRepositoryImpl = new JdbcTokenRepositoryImpl(); jdbcTokenRepositoryImpl.setJdbcTemplate(jdbcTemplate); jdbcTokenRepositoryImpl.setCreateTableOnStartup(false); return jdbcTokenRepositoryImpl; }
private static HttpSecurity protect(String path, String role, HttpSecurity security, PersistentTokenRepository tokenRepository) throws Exception { return security.antMatcher(format("%s/**", path)).authorizeRequests().anyRequest().hasAnyAuthority(role) .and().formLogin().loginPage(format("%s/login", path)).passwordParameter("lg_mrg_pwddw").usernameParameter("lg_mrg_usdfer").permitAll() .and().logout().logoutUrl(format("%s/logout", path)).permitAll() .and().csrf() .and().rememberMe().tokenRepository(tokenRepository).tokenValiditySeconds(1209600).and(); }
@Override public void afterPropertiesSet() throws Exception { try{ Map<String,?> beans = applicationContext.getBeansOfType(PersistentTokenRepository.class); if (beans.size() == 0) { throw new ApplicationContextException("No PersistentTokenRepository registered."); } else if (beans.size() > 1) { throw new ApplicationContextException("More than one PersistentTokenRepository registered."); } this.tokenRepository = (PersistentTokenRepository) beans.values().toArray()[0]; }catch(Exception e){ } }
@Bean public PersistentTokenRepository jdbcTokenRepository() { JdbcTokenRepositoryImpl repository = new JdbcTokenRepositoryImpl(); repository.setCreateTableOnStartup(false); repository.setDataSource(dataSource); return repository; }
/** * Creates a new {@link IpAwarePersistentTokenRepository} that after converting the seriesId to contain the current * user's IP address will use the delegateRepository to do all the work. * * @param delegateRepository */ public IpAwarePersistentTokenRepository(PersistentTokenRepository delegateRepository) { if (delegateRepository == null) { throw new IllegalArgumentException("delegateRepository cannot be null"); } this.delegateRepository = delegateRepository; }
@Bean public PersistentTokenRepository persistentTokenRepository() { JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl(); tokenRepository.setDataSource(dataSource); return tokenRepository; }
public PersistentJwtTokenBasedRememberMeServices( String key, UserDetailsService userDetailsService, PersistentTokenRepository tokenRepository) { super(key, userDetailsService, tokenRepository); }
@Bean public PersistentTokenRepository persistentTokenRepository(SessionService sessionService) { return new DelegatingPersistentTokenRepository(sessionService); }
@Bean public PersistentTokenRepository persistentTokenRepository(){ JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl(); tokenRepository.setDataSource(dataSource); return tokenRepository; }
@Bean public PersistentTokenRepository persistentTokenRepository() { final JdbcTokenRepositoryImpl jdbcTokenRepositoryImpl = new JdbcTokenRepositoryImpl(); jdbcTokenRepositoryImpl.setDataSource(dataSource); return jdbcTokenRepositoryImpl; }
private PersistentTokenRepository persistentTokenRepository() { JdbcTokenRepositoryImpl tr = new JdbcTokenRepositoryImpl(); tr.setJdbcTemplate(jdbc); return tr; }
@Bean public PersistentTokenRepository persistentTokenRepository() { JdbcTokenRepositoryImpl repo = new JdbcTokenRepositoryImpl(); repo.setDataSource(dataSource); return repo; }
public PersistentRememberMeServices(String key, UserDetailsService userDetailsService, PersistentTokenRepository tokenRepository) { super(key, userDetailsService); random = new SecureRandom(); this.tokenRepository = tokenRepository; }
@Bean public PersistentTokenRepository persistentTokenRepository() { return new RememberMeTokenServiceImpl(rememberMeTokenRepository); }
public PersistentTokenBasedRememberMeServicesEx(String key, UserDetailsService userDetailsService, PersistentTokenRepository tokenRepository) { super(key, userDetailsService, tokenRepository); }
public VaadinPersistentTokenBasedRememberMeServices(String key, UserDetailsService userDetailsService, PersistentTokenRepository tokenRepository) { super(key, userDetailsService, tokenRepository); }
@Bean public PersistentTokenRepository persistentTokenRepository() { return new MongoPersistentTokenRepositoryImpl(rememberMeTokenRepository); }
/** * <p>persistentTokenRepository.</p> * * @return a {@link org.springframework.security.web.authentication.rememberme.PersistentTokenRepository} object. */ @Bean public PersistentTokenRepository persistentTokenRepository() { return new MongoPersistentTokenRepositoryImpl(rememberMeTokenRepository); }