本文整理匯總了Java中org.springframework.security.config.annotation.SecurityConfigurerAdapter類的典型用法代碼示例。如果您正苦於以下問題:Java SecurityConfigurerAdapter類的具體用法?Java SecurityConfigurerAdapter怎麽用?Java SecurityConfigurerAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SecurityConfigurerAdapter類屬於org.springframework.security.config.annotation包,在下文中一共展示了SecurityConfigurerAdapter類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configure
import org.springframework.security.config.annotation.SecurityConfigurerAdapter; //導入依賴的package包/類
@Override
public void configure(HttpSecurity http) throws Exception {
http.requestMatchers().anyRequest().and()
.authorizeRequests().anyRequest()
.authenticated().and().csrf()
.csrfTokenRepository(csrfTokenRepository()).and()
.addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);
OAuth2SsoProperties sso = this.beanFactory.getBean(OAuth2SsoProperties.class);
// Delay the processing of the filter until we know the
// SessionAuthenticationStrategy is available:
http.apply(
(SecurityConfigurerAdapter) new OAuth2ClientAuthenticationConfigurer(oauth2SsoFilter(sso))
);
addAuthenticationEntryPoint(http, sso);
}
示例2: getOrApply
import org.springframework.security.config.annotation.SecurityConfigurerAdapter; //導入依賴的package包/類
@SneakyThrows
private <C extends SecurityConfigurerAdapter<Void, ServiceProviderBuilder>> C getOrApply(
C configurer) {
C existingConfig = (C) getConfigurer(configurer.getClass());
if (existingConfig != null) {
return existingConfig;
}
return apply(configurer);
}
示例3: reApply
import org.springframework.security.config.annotation.SecurityConfigurerAdapter; //導入依賴的package包/類
@SneakyThrows
private <C extends SecurityConfigurerAdapter<Void, ServiceProviderBuilder>> void reApply(C configurer) {
C existing = (C) removeConfigurer(configurer.getClass());
apply(existing);
}