本文整理汇总了Java中org.springframework.security.web.authentication.rememberme.PersistentTokenRepository类的典型用法代码示例。如果您正苦于以下问题:Java PersistentTokenRepository类的具体用法?Java PersistentTokenRepository怎么用?Java PersistentTokenRepository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PersistentTokenRepository类属于org.springframework.security.web.authentication.rememberme包,在下文中一共展示了PersistentTokenRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: persistentTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
/**
* Used to store the persistent login tokens for a user.
*/
@Bean
public PersistentTokenRepository persistentTokenRepository() {
final JdbcTokenRepositoryImpl impl = new JdbcTokenRepositoryImpl();
impl.setDataSource(dataSource);
return impl;
}
示例2: customizeRememberMe
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@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);
}
示例3: persistentTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
/**
* Persistent token repository persistent token repository.
*
* @return the persistent token repository
*/
@Bean
public PersistentTokenRepository persistentTokenRepository() {
JdbcTokenRepositoryImpl jdbcTokenRepository = new JdbcTokenRepositoryImpl();
jdbcTokenRepository.setDataSource(dataSource);
return jdbcTokenRepository;
}
示例4: rememberMeServices
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@Bean
public RememberMeServices rememberMeServices(
UserDetailsService userDetailsService, PersistentTokenRepository persistentTokenRepository) {
String secretKey = getRememberMeTokenSecretKey().orElseThrow(IllegalStateException::new);
return new PersistentJwtTokenBasedRememberMeServices(
secretKey, userDetailsService, persistentTokenRepository);
}
示例5: persistentTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@Bean
public PersistentTokenRepository persistentTokenRepository() {
JdbcTokenRepositoryImpl db = new JdbcTokenRepositoryImpl();
db.setDataSource(dataSource);
return db;
}
示例6: persistentTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@Bean
public PersistentTokenRepository persistentTokenRepository(JdbcTemplate jdbcTemplate) {
JdbcTokenRepositoryImpl jdbcTokenRepositoryImpl = new JdbcTokenRepositoryImpl();
jdbcTokenRepositoryImpl.setJdbcTemplate(jdbcTemplate);
jdbcTokenRepositoryImpl.setCreateTableOnStartup(false);
return jdbcTokenRepositoryImpl;
}
示例7: protect
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
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();
}
示例8: afterPropertiesSet
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@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){
}
}
示例9: jdbcTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@Bean
public PersistentTokenRepository jdbcTokenRepository() {
JdbcTokenRepositoryImpl repository = new JdbcTokenRepositoryImpl();
repository.setCreateTableOnStartup(false);
repository.setDataSource(dataSource);
return repository;
}
示例10: IpAwarePersistentTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
/**
* 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;
}
示例11: persistentTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@Bean
public PersistentTokenRepository persistentTokenRepository() {
JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
tokenRepository.setDataSource(dataSource);
return tokenRepository;
}
示例12: PersistentJwtTokenBasedRememberMeServices
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
public PersistentJwtTokenBasedRememberMeServices(
String key, UserDetailsService userDetailsService,
PersistentTokenRepository tokenRepository) {
super(key, userDetailsService, tokenRepository);
}
示例13: persistentTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@Bean
public PersistentTokenRepository persistentTokenRepository(SessionService sessionService) {
return new DelegatingPersistentTokenRepository(sessionService);
}
示例14: persistentTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@Bean
public PersistentTokenRepository persistentTokenRepository() {
JdbcTokenRepositoryImpl db = new JdbcTokenRepositoryImpl();
db.setDataSource(dataSource);
return db;
}
示例15: persistentTokenRepository
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; //导入依赖的package包/类
@Bean
public PersistentTokenRepository persistentTokenRepository(){
JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
tokenRepository.setDataSource(dataSource);
return tokenRepository;
}