當前位置: 首頁>>代碼示例>>Java>>正文


Java WebSecurity類代碼示例

本文整理匯總了Java中org.springframework.security.config.annotation.web.builders.WebSecurity的典型用法代碼示例。如果您正苦於以下問題:Java WebSecurity類的具體用法?Java WebSecurity怎麽用?Java WebSecurity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WebSecurity類屬於org.springframework.security.config.annotation.web.builders包,在下文中一共展示了WebSecurity類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
/**
 * This is the equivalent to:
 * <pre>
 *     <http pattern="/resources/**" security="none"/>
 *     <http pattern="/css/**" security="none"/>
 *     <http pattern="/webjars/**" security="none"/>
 * </pre>
 *
 * @param web
 * @throws Exception
 */
@Override
public void configure(final WebSecurity web) throws Exception {

    // Ignore static resources and webjars from Spring Security
    web.ignoring()
            .antMatchers("/resources/**")
            .antMatchers("/css/**")
            .antMatchers("/webjars/**")
    ;

    // Thymeleaf needs to use the Thymeleaf configured FilterSecurityInterceptor
    // and not the default Filter from AutoConfiguration.
    final HttpSecurity http = getHttp();
    web.postBuildAction(() -> {
        web.securityInterceptor(http.getSharedObject(FilterSecurityInterceptor.class));
    });
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:29,代碼來源:SecurityConfig.java

示例2: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
/**
 * This is the equivalent to:
 * <pre>
 *     <http pattern="/resources/**" security="none"/>
 *     <http pattern="/css/**" security="none"/>
 *     <http pattern="/webjars/**" security="none"/>
 * </pre>
 *
 * @param web WebSecurity
 * @throws Exception
 */
@Override
public void configure(final WebSecurity web) throws Exception {
    web.ignoring()
            .antMatchers("/resources/**")
            .antMatchers("/css/**")
            .antMatchers("/webjars/**")
    ;

    // Thymeleaf needs to use the Thymeleaf configured FilterSecurityInterceptor
    // and not the default Filter from AutoConfiguration.
    final HttpSecurity http = getHttp();
    web.postBuildAction(() -> {
        web.securityInterceptor(http.getSharedObject(FilterSecurityInterceptor.class));
    });
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:27,代碼來源:SecurityConfig.java

示例3: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
/**
     * This is the equivalent to:
     * <pre>
     *     <http pattern="/resources/**" security="none"/>
     *     <http pattern="/css/**" security="none"/>
     *     <http pattern="/webjars/**" security="none"/>
     * </pre>
     *
     * @param web
     * @throws Exception
     */
    @Override
    public void configure(final WebSecurity web) throws Exception {

        // Ignore static resources and webjars from Spring Security
        web.ignoring()
                .antMatchers("/resources/**")
                .antMatchers("/css/**")
                .antMatchers("/webjars/**")
        ;

        // Thymeleaf needs to use the Thymeleaf configured FilterSecurityInterceptor
        // and not the default Filter from AutoConfiguration.
        final HttpSecurity http = getHttp();
        web.postBuildAction(() -> {
//            web.securityInterceptor(http.getSharedObject(FilterSecurityInterceptor.class));
            FilterSecurityInterceptor fsi = http.getSharedObject(FilterSecurityInterceptor.class);
            fsi.setSecurityMetadataSource(metadataSource);
            web.securityInterceptor(fsi);
        });
    }
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:32,代碼來源:SecurityConfig.java

示例4: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
/**
 * This is the equivalent to:
 * <pre>
 *     <http pattern="/resources/**" security="none"/>
 *     <http pattern="/css/**" security="none"/>
 *     <http pattern="/webjars/**" security="none"/>
 * </pre>
 *
 * @param web
 * @throws Exception
 */
@Override
public void configure(final WebSecurity web) throws Exception {

    // Ignore static resources and webjars from Spring Security
    web.ignoring()
            .antMatchers("/resources/**")
            .antMatchers("/css/**")
            .antMatchers("/webjars/**")
    ;


    // Thymeleaf needs to use the Thymeleaf configured FilterSecurityInterceptor
    // and not the default Filter from AutoConfiguration.
    final HttpSecurity http = getHttp();
    web.postBuildAction(() -> {
        web.securityInterceptor(http.getSharedObject(FilterSecurityInterceptor.class));
    });
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:30,代碼來源:SecurityConfig.java

示例5: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
/**
 * This is the equivalent to:
 * <pre>
 *     <http pattern="/resources/**" security="none"/>
 *     <http pattern="/css/**" security="none"/>
 *     <http pattern="/webjars/**" security="none"/>
 * </pre>
 *
 * see https://w3stacks.com/questions/spring-boot/3925/spring-boot-security-thymeleaf-sec-authorize-url-not-working
 * See http://vkuzel.blogspot.com/2017/02/how-not-to-get-confused-by-spring-boot.html
 *
 * @param web
 * @throws Exception
 */
@Override
public void configure(final WebSecurity web) throws Exception {

    // Ignore static resources and webjars from Spring Security
    web.ignoring()
            .antMatchers("/resources/**")
            .antMatchers("/css/**")
            .antMatchers("/webjars/**")
    ;


    // Thymeleaf needs to use the Thymeleaf configured FilterSecurityInterceptor
    // and not the default Filter from AutoConfiguration.
    final HttpSecurity http = getHttp();
    web.postBuildAction(() -> {
        web.securityInterceptor(http.getSharedObject(FilterSecurityInterceptor.class));
    });
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:33,代碼來源:SecurityConfig.java

示例6: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
@Override
public void configure(WebSecurity web) throws Exception {
    web.ignoring()
        .antMatchers(HttpMethod.OPTIONS, "/**")
        .antMatchers("/app/**/*.{js,html}")
        .antMatchers("/bower_components/**")
        .antMatchers("/i18n/**")
        .antMatchers("/content/**")
        .antMatchers("/swagger-ui/index.html")
        .antMatchers("/test/**")
        .antMatchers("/h2-console/**");
}
 
開發者ID:oktadeveloper,項目名稱:jhipster-microservices-example,代碼行數:13,代碼來源:MicroserviceSecurityConfiguration.java

示例7: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
@Override
public void configure(WebSecurity web) throws Exception {
     web
       .ignoring()
          .antMatchers("/resources/**")
          .antMatchers("/css/**")
          .antMatchers("/js/**")
          .antMatchers("/image/**"); 
   }
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:10,代碼來源:AppSecurityModelB.java

示例8: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
@Override
public void configure(WebSecurity web) throws Exception {
  web
    .ignoring()
       .antMatchers("/resources/**")
       .antMatchers("/css/**")
       .antMatchers("/js/**")
       .antMatchers("/image/**");
}
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:10,代碼來源:AppSecurityModelA.java

示例9: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
@Override
public void configure(WebSecurity web) throws Exception {
     web
       .ignoring()
          .antMatchers("/resources/**")
          .antMatchers("/css/**")
          .antMatchers("/js/**")
          .antMatchers("/image/**");
   }
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:10,代碼來源:AppSecurityModelE2.java

示例10: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
@Override
public void configure(WebSecurity web) throws Exception {
   web
      .ignoring()
         .antMatchers("/resources/**")
         .antMatchers("/css/**")
         .antMatchers("/js/**")
         .antMatchers("/image/**");
  }
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:10,代碼來源:AppSecurityModelC.java

示例11: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
@Override
public void configure(WebSecurity web) throws Exception {
    web.ignoring()
        .antMatchers("/scripts/**/*.{js,html}")
        .antMatchers("/bower_components/**")
        .antMatchers("/i18n/**")
        .antMatchers("/assets/**")
        .antMatchers("/swagger-ui/index.html")
        .antMatchers("/test/**");
}
 
開發者ID:GastonMauroDiaz,項目名稱:buenojo,代碼行數:11,代碼來源:SecurityConfiguration.java

示例12: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
@Override
public void configure(WebSecurity web) throws Exception {
  // Ignore security for the Swagger documentation.
  web.ignoring()
      .antMatchers("/configuration/ui")
      .antMatchers("/images/**")
      .antMatchers("/swagger-resources")
      .antMatchers("/swagger-ui.html")
      .antMatchers("/v2/api-docs")
      .antMatchers("/webjars/**");
}
 
開發者ID:melphi,項目名稱:java-api-best-practices,代碼行數:12,代碼來源:SecurityConfiguration.java

示例13: configure

import org.springframework.security.config.annotation.web.builders.WebSecurity; //導入依賴的package包/類
/**
 * This is the equivalent to:
 * <pre><http pattern="/resources/**" security="none"/></pre>
 *
 * @param web
 * @throws Exception
 */
@Override
public void configure(final WebSecurity web) throws Exception {
    web.ignoring()
            .antMatchers("/resources/**")
            .antMatchers("/webjars/**")
    ;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:15,代碼來源:SecurityConfig.java


注:本文中的org.springframework.security.config.annotation.web.builders.WebSecurity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。