use of org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl in project judge by zjnu-acm.
the class TokenRepositoryConfiguration method persistentTokenRepository.
@Bean
public PersistentTokenRepository persistentTokenRepository(JdbcTemplate jdbcTemplate) {
JdbcTokenRepositoryImpl jdbcTokenRepositoryImpl = new JdbcTokenRepositoryImpl();
jdbcTokenRepositoryImpl.setJdbcTemplate(jdbcTemplate);
jdbcTokenRepositoryImpl.setCreateTableOnStartup(false);
return jdbcTokenRepositoryImpl;
}
use of org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl in project yqq by yeycfri.
the class SecurityConfig method persistentTokenRepository.
@Bean
public PersistentTokenRepository persistentTokenRepository() {
JdbcTokenRepositoryImpl db = new JdbcTokenRepositoryImpl();
db.setDataSource(dataSource);
return db;
}
use of org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl in project paascloud-master by paascloud.
the class PcResourceServerConfig method persistentTokenRepository.
/**
* 记住我功能的token存取器配置
*
* @return the persistent token repository
*/
@Bean
public PersistentTokenRepository persistentTokenRepository() {
JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
tokenRepository.setDataSource(dataSource);
// tokenRepository.setCreateTableOnStartup(true); // 第一次启动创建
return tokenRepository;
}
use of org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl in project nzbhydra2 by theotherp.
the class SecurityConfig method configure.
@Override
protected void configure(HttpSecurity http) throws Exception {
BaseConfig baseConfig = configProvider.getBaseConfig();
if (configProvider.getBaseConfig().getMain().isUseCsrf()) {
http.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
} else {
http.csrf().disable();
}
http.headers().frameOptions().disable();
if (baseConfig.getAuth().getAuthType() == AuthType.BASIC) {
http = http.httpBasic().authenticationDetailsSource(new WebAuthenticationDetailsSource() {
@Override
public WebAuthenticationDetails buildDetails(HttpServletRequest context) {
return new HydraWebAuthenticationDetails(context);
}
}).and().logout().logoutUrl("/logout").and();
} else if (baseConfig.getAuth().getAuthType() == AuthType.FORM) {
http = http.authorizeRequests().antMatchers("/internalapi/userinfos").permitAll().and().formLogin().loginPage("/login.html").loginProcessingUrl("/login").permitAll().authenticationDetailsSource(new WebAuthenticationDetailsSource() {
@Override
public WebAuthenticationDetails buildDetails(HttpServletRequest context) {
return new HydraWebAuthenticationDetails(context);
}
}).and().logout().permitAll().logoutUrl("/logout").deleteCookies("rememberMe").and();
}
if (baseConfig.getAuth().isAuthConfigured()) {
enableAnonymousAccessIfConfigured(http);
if (baseConfig.getAuth().isRememberUsers()) {
JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
tokenRepository.setDataSource(dataSource());
http = http.rememberMe().alwaysRemember(true).tokenValiditySeconds(configProvider.getBaseConfig().getAuth().getRememberMeValidityDays() * SECONDS_PER_DAY).tokenRepository(tokenRepository).and();
}
http.logout().logoutUrl("/logout").logoutSuccessUrl("/").deleteCookies("rememberMe");
}
http.exceptionHandling().accessDeniedHandler(authAndAccessEventHandler);
}
Aggregations