Home > Mobile >  Pom.xml file dependencies not found
Pom.xml file dependencies not found

Time:12-08

enter image description here enter image description here

When I try to check my spring registration request, it should return the message "it Works," but I get nothing. Does anyone have any ideas what might be wrong? enter image description here

CodePudding user response:

I had missed an API link in the.antMatchers section of the WebSecurityConfig file.

CodePudding user response:

If you preview your postman response you can see a login form which means you are not authenticated. If your signup request does not need any authentication you can simply exclude your registration api endpoint from spring checks. To do that permit all requests to the particular url in your configuration file

If you are using WebSecurityConfigurerAdapter, add an antMatcher entry to your configure method.

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
    .authorizeRequests()
    .antMatchers("/api/v1/registration").permitAll()
    .anyRequest().authenticated();
}

Since WebSecurityConfigurerAdapter is deprecated now if you want to use SecurityFilterChain you can do it as follows. For more info refer documentation.

@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
    http.authorizeRequests()
        .antMatchers("/api/v1/registration").permitAll()
        .anyRequest().authenticated();

    return http.build();
}
  • Related