Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
spring引导安全性请求意外授权_Spring_Spring Boot_Authentication_Spring Security - Fatal编程技术网

spring引导安全性请求意外授权

spring引导安全性请求意外授权,spring,spring-boot,authentication,spring-security,Spring,Spring Boot,Authentication,Spring Security,我正在使用spring boot进行身份验证项目。 我使用了SpringStarter安全性,但我面临的问题是我希望允许所有人都可以访问某些页面。但是spring也要求在使用这些网页时进行身份验证 我尝试过以下代码: @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeReq

我正在使用spring boot进行身份验证项目。 我使用了SpringStarter安全性,但我面临的问题是我希望允许所有人都可以访问某些页面。但是spring也要求在使用这些网页时进行身份验证

我尝试过以下代码:

@Override
    protected void configure(HttpSecurity http) throws Exception {
        http
        .csrf().disable()
            .authorizeRequests().antMatchers("/","/signUp").permitAll().anyRequest().authenticated()
            .and()
            .httpBasic();
       }
我也使用了以下代码,但也没有按照我描述的预期方式工作,并要求进行身份验证

预计它将允许在不进行身份验证的情况下访问这些页面,但它要求进行身份验证。

尝试使用
.antMatchers(HttpMethod.Method,“/endpoint”)
/**
配置(HttpSecurity http)

如果要绕过某些端点的安全筛选器链,请使用
configure(WebSecurity web)


你叫什么URL?还显示您的完整Spring安全配置。您是否以正确的方式注释了类?`@Configuration@EnableWebSecurity公共类AppSecurityConfig扩展了WebSecurityConfigureAdapter{@Autowired private userDetails服务userDetails服务;@Bean public AuthenticationProvider authProvider(){DaoAuthenticationProvider=new DaoAuthenticationProvider();provider.setUserDetailsService(userDetailsService);provider.setPasswordEncoder(new BCryptPasswordEncoder());return provider;}[我在这里发布的上述方法]}`你能分享你的请求吗
@Override
    protected void configure(HttpSecurity http) throws Exception {
        http
        .csrf().disable()
            .authorizeRequests().antMatchers("/").permitAll()
            .and()
            .httpBasic();
     }
    @Override
    protected void configure(HttpSecurity http) throws Exception{

         http
         .csrf().disable()
         .authorizeRequests()
         .antMatchers("/**","/signUp").permitAll()
         .antMatchers(HttpMethod.POST,"/endpointPOST").permitAll()
         .antMatchers(HttpMethod.GET,"/endpointGET").permitAll()
         .anyRequest().authenticated();

    }
    @Override
    public void configure(WebSecurity web) throws Exception {
        web
          .ignoring()
            .antMatchers("/signUp", "**/endpoint/**");
    }