简体   繁体   中英

Spring security + scratch java extension

Creating scratches for my HTTP requests to test endpoints , however since spring security is set I am getting HTTP/1.1 403 Forbidden

How can i solve this, I know every time I run my project spring security generates a new key, however maybe there is a way for scratch file to get that key or something.

Thank you

Check your WebSecurityConfig Class. I think you need configure your endpoints like this:

protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity.cors();
        httpSecurity.csrf().disable();
        httpSecurity.authorizeRequests()
                .antMatchers(HttpMethod.POST, "/user").permitAll()
                .antMatchers(HttpMethod.POST, "/authenticate").permitAll()
   //some code
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM