当前位置: 首页>>代码示例>>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;未经允许,请勿转载。