Having a problem using auth.requestMatchers its not accepting string as an argument, I tried using antMachers but was showing no response to the post request
return httpSecurity
.authorizeHttpRequests(auth -> auth
.requestMatchers("/authenticate").permitAll()
.requestMatchers(PathRequest.toH2Console()).permitAll() // h2-console is a servlet and NOT recommended for a production
.requestMatchers(HttpMethod.OPTIONS,"/**")
.permitAll()
.anyRequest()
.authenticated())
.csrf(AbstractHttpConfigurer::disable)
.sessionManagement(session -> session.
sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.oauth2ResourceServer(
OAuth2ResourceServerConfigurer::jwt)
.httpBasic(
Customizer.withDefaults())
.headers(header -> {header.
frameOptions().sameOrigin();})
.build();
}`
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>