Java Code Examples for org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl#setDataSource()

The following examples show how to use org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl#setDataSource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecurityConfig.java    From fw-spring-cloud with Apache License 2.0 5 votes vote down vote up
@Bean
    public PersistentTokenRepository persistentTokenRepository() {
        JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
        tokenRepository.setDataSource(dataSource);
//        tokenRepository.setCreateTableOnStartup(true);
        return tokenRepository;
    }
 
Example 2
Source File: BrowserSecurityConfig.java    From SpringAll with MIT License 5 votes vote down vote up
@Bean
public PersistentTokenRepository persistentTokenRepository() {
    JdbcTokenRepositoryImpl jdbcTokenRepository = new JdbcTokenRepositoryImpl();
    jdbcTokenRepository.setDataSource(dataSource);
    jdbcTokenRepository.setCreateTableOnStartup(false);
    return jdbcTokenRepository;
}
 
Example 3
Source File: MultiHttpSecurityConfig.java    From enhanced-pet-clinic with Apache License 2.0 5 votes vote down vote up
@Bean
public RememberMeServices getRememberMeServices() {
	JdbcUserDetailsManager jdbcUserDetailsManager = new JdbcUserDetailsManager();
	jdbcUserDetailsManager.setDataSource(dataSource);

	JdbcTokenRepositoryImpl jdbcTokenRepositoryImpl = new JdbcTokenRepositoryImpl();
	jdbcTokenRepositoryImpl.setDataSource(dataSource);

	PersistentTokenBasedRememberMeServices services = new PersistentTokenBasedRememberMeServices(
			rememberMeToken, jdbcUserDetailsManager, jdbcTokenRepositoryImpl);
	services.setParameter(rememberMeParameter);
	return services;
}
 
Example 4
Source File: PcResourceServerConfig.java    From paascloud-master with Apache License 2.0 5 votes vote down vote up
/**
	 * 记住我功能的token存取器配置
	 *
	 * @return the persistent token repository
	 */
	@Bean
	public PersistentTokenRepository persistentTokenRepository() {
		JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
		tokenRepository.setDataSource(dataSource);
//		tokenRepository.setCreateTableOnStartup(true); // 第一次启动创建
		return tokenRepository;
	}
 
Example 5
Source File: WebSecurityConfig.java    From jvue-admin with MIT License 5 votes vote down vote up
@Bean
public PersistentTokenRepository tokenRepository() {
	JdbcTokenRepositoryImpl jdbcTokenRepositoryImpl = new JdbcTokenRepositoryImpl();
	jdbcTokenRepositoryImpl.setDataSource(dataSource);
	// jdbcTokenRepositoryImpl.setCreateTableOnStartup(true);
	return jdbcTokenRepositoryImpl;
}
 
Example 6
Source File: WebSecurityConfig.java    From blog-sample with Apache License 2.0 5 votes vote down vote up
@Bean
    public PersistentTokenRepository persistentTokenRepository() {
        JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
        tokenRepository.setDataSource(dataSource);
        // 如果token表不存在,使用下面语句可以初始化该表;若存在,会报错。
//        tokenRepository.setCreateTableOnStartup(true);
        return tokenRepository;
    }
 
Example 7
Source File: SecurityConfig.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 5 votes vote down vote up
@Bean
public PersistentTokenRepository jdbcTokenRepository() {
	JdbcTokenRepositoryImpl repository = new JdbcTokenRepositoryImpl();
	repository.setCreateTableOnStartup(false);
	repository.setDataSource(dataSource);			
	return repository;
}
 
Example 8
Source File: BrowserSecurityConfig.java    From imooc-security with Apache License 2.0 5 votes vote down vote up
@Bean
    public PersistentTokenRepository persistentTokenRepository(){
        JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
        tokenRepository.setDataSource(dataSource);
//        tokenRepository.setCreateTableOnStartup(true);
        return tokenRepository;
    }
 
Example 9
Source File: WebSecurityConfig.java    From blog-sample with Apache License 2.0 5 votes vote down vote up
@Bean
    public PersistentTokenRepository persistentTokenRepository() {
        JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
        tokenRepository.setDataSource(dataSource);
        // 如果token表不存在,使用下面语句可以初始化该表;若存在,会报错。
//        tokenRepository.setCreateTableOnStartup(true);
        return tokenRepository;
    }
 
Example 10
Source File: WebSecurityConfig.java    From danyuan-application with Apache License 2.0 5 votes vote down vote up
@Bean
public PersistentTokenRepository tokenRepository() {
	JdbcTokenRepositoryImpl jdbcTokenRepository = new JdbcTokenRepositoryImpl();
	jdbcTokenRepository.setDataSource(dataSource);
	// 设置为true,则项目启动时,会在对应数据源中自动建表token表
	jdbcTokenRepository.setCreateTableOnStartup(false);
	return jdbcTokenRepository;
}
 
Example 11
Source File: WebSecurityConfig.java    From blog-sample with Apache License 2.0 5 votes vote down vote up
@Bean
    public PersistentTokenRepository persistentTokenRepository() {
        JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
        tokenRepository.setDataSource(dataSource);
        // 如果token表不存在,使用下面语句可以初始化该表;若存在,会报错。
//        tokenRepository.setCreateTableOnStartup(true);
        return tokenRepository;
    }
 
Example 12
Source File: OauthWebServerSecurityConfig.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 记住我功能的token存取器配置
 */
@Bean
public PersistentTokenRepository persistentTokenRepository() {
	JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
	tokenRepository.setDataSource(dataSource);
	return tokenRepository;
}
 
Example 13
Source File: OauthWebServerSecurityConfig.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 记住我功能的token存取器配置
 */
@Bean
public PersistentTokenRepository persistentTokenRepository() {
	JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
	tokenRepository.setDataSource(dataSource);
	return tokenRepository;
}
 
Example 14
Source File: WebSecurityConfig.java    From fredbet with Creative Commons Attribution Share Alike 4.0 International 4 votes vote down vote up
@Bean
public PersistentTokenRepository persistentTokenRepository() {
    JdbcTokenRepositoryImpl jdbcTokenRepositoryImpl = new JdbcTokenRepositoryImpl();
    jdbcTokenRepositoryImpl.setDataSource(dataSource);
    return jdbcTokenRepositoryImpl;
}
 
Example 15
Source File: WebSecurityConfigration.java    From Taroco with Apache License 2.0 4 votes vote down vote up
/**
 * RememberMeServices
 */
public RememberMeServices rememberMeServices() {
    final JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
    tokenRepository.setDataSource(dataSource);
    return new PersistentTokenBasedRememberMeServices(RM_KEY, userNameUserDetailsService, tokenRepository);
}
 
Example 16
Source File: SecurityConfig.java    From QuizZz with MIT License 4 votes vote down vote up
@Bean
public PersistentTokenRepository persistentTokenRepository() {
	JdbcTokenRepositoryImpl db = new JdbcTokenRepositoryImpl();
	db.setDataSource(dataSource);
	return db;
}
 
Example 17
Source File: LoginSuccessHandlerConfig.java    From base-admin with MIT License 4 votes vote down vote up
@Bean
public PersistentTokenRepository persistentTokenRepository1() {
    JdbcTokenRepositoryImpl persistentTokenRepository = new JdbcTokenRepositoryImpl();
    persistentTokenRepository.setDataSource(dataSource);
    return persistentTokenRepository;
}
 
Example 18
Source File: SecurityConfig.java    From Spring5Tutorial with GNU Lesser General Public License v3.0 4 votes vote down vote up
public PersistentTokenRepository persistentTokenRepository() {
    JdbcTokenRepositoryImpl repo = new JdbcTokenRepositoryImpl();
    repo.setDataSource(dataSource());
    return repo;
}
 
Example 19
Source File: SecurityConfig.java    From Spring5Tutorial with GNU Lesser General Public License v3.0 4 votes vote down vote up
public PersistentTokenRepository persistentTokenRepository() {
    JdbcTokenRepositoryImpl repo = new JdbcTokenRepositoryImpl();
    repo.setDataSource(dataSource());
    return repo;
}
 
Example 20
Source File: SecurityConfig.java    From Spring with Apache License 2.0 3 votes vote down vote up
/**
 * Save data to db table
 *
 * Default SQL for creating the database table to store the tokens
 * public static final String CREATE_TABLE_SQL = "create table persistent_logins (username varchar(64) not null, series varchar(64) primary key, "
 *		+ "token varchar(64) not null, last_used timestamp not null)";
 */
@Bean
public PersistentTokenRepository persistentTokenRepository() {
	final JdbcTokenRepositoryImpl  db = new JdbcTokenRepositoryImpl();
	db.setDataSource(dataSource);
	return db;
}