Here is the security configuration I am using
@Configuration
public class SpringSecurityConfiguration {
@Bean
public SecurityFilterChain getFilter(HttpSecurity http) throws Exception{
http.csrf().disable();
http.authorizeHttpRequests(
auth->auth.anyRequest().authenticated()
);
http.httpBasic(Customizer.withDefaults());
return http.build();
}
}
I have two endpoints
- loginUser as get method ->whose authentications is working
- registerUser as post method -> whose authentication is always failing.
Version used :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Any suggestion why the registerUser endpoint is alone failing?
Actually, I don't want any authentication for registry endpoint. So I tried disabling authentication for that path using "requestMatchers". Even after disabling, I am getting 401 unauthorized error. So while debugging, I removed the requestMatchers settings and tried authenticating as It should authenticate but it is failing. Also, I tried disabling csrf, but not working