本文整理匯總了Java中org.springframework.security.config.annotation.web.builders.HttpSecurity.addFilter方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpSecurity.addFilter方法的具體用法?Java HttpSecurity.addFilter怎麽用?Java HttpSecurity.addFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.security.config.annotation.web.builders.HttpSecurity
的用法示例。
在下文中一共展示了HttpSecurity.addFilter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configure
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //導入方法依賴的package包/類
@Override
protected void configure(HttpSecurity http) throws Exception {
http = http.addFilter(new WebAsyncManagerIntegrationFilter());
http = http.addFilterBefore(jwtAuthFilter(), UsernamePasswordAuthenticationFilter.class);
http
.antMatcher("/ext/**")
.csrf().requireCsrfProtectionMatcher(csrfSecurityRequestMatcher).and()
.headers().frameOptions().sameOrigin().and()
.authorizeRequests()
.antMatchers("/ext/stream/**", "/ext/coverArt*", "/ext/share/**", "/ext/hls/**")
.hasAnyRole("TEMP", "USER").and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.exceptionHandling().and()
.securityContext().and()
.requestCache().and()
.anonymous().and()
.servletApi();
}
示例2: configure
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //導入方法依賴的package包/類
/**
* Configure spring security to enable a simple webform-login + a simple rest login.
*/
@Override
public void configure(HttpSecurity http) throws Exception {
super.configure(http);
// usage of addFilter is sufficient for BasicAuthenticationFilter.class. The filter will be added according to the
// order defined in:
// http://docs.spring.io/autorepo/docs/spring-security/4.1.0.RC1/apidocs/org/springframework/security/config/annotation/web/builders/HttpSecurity.html#addFilter-javax.servlet.Filter-
http.addFilter(basicAuthenticationFilter());
// Use the following to disable csrf in tests
http.csrf().disable();
LOG.debug("used non static class");
}