The spring boot integration spring security access interface does not respond

status:

Send an access request through the browser:

localhost:9000/files/downloadInsert picture description here

Enter user and password

Insert picture description here

If the password is not set, the console will have

Using generated security password: 75a2959a-522c-4335-830d-d247e7b4743b

Will visit normally

Insert picture description here

Solution

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    
    

    @Override
    public void configure(WebSecurity web) throws Exception {
    
    
        //忽略权限授权接口,填写路径就好
        web.ignoring().antMatchers("/sysUsers/*", "/auth/*", "/files/*");
    }

//    @Override
//    public void configure(HttpSecurity http) throws Exception {
    
    
////         任意请求允许无授权访问
//        http.authorizeRequests()
//                .anyRequest().permitAll();
////        http.csrf().disable().exceptionHandling().authenticationEntryPoint(getAccessDeniedHandler());
//    }
}

Guess you like

Origin blog.csdn.net/weixin_42096620/article/details/111525729