szerhusenBC/jwt-spring-security-demo

Rest service - User has been authenticated but no Mapping found for HTTP request

Closed this issue · 4 comments

I am doing rest modules in Micro-services No JSP or Login page.
User is authenticated
[JwtAuthenticationTokenFilter.java:56]authenticated user admin, setting security context

PageNotFound [DispatcherServlet.java:1172]No mapping found for HTTP request with URI [/rest-moudle/test] in DispatcherServlet with name 'dispatcherServlet'

Below is my WebConfig. configure(HttpSecurity httpSecurity)
I pretty much opened every incoming request no matter what it is but still does not find the mapping page.
.antMatchers(HttpMethod.GET, "/").permitAll().antMatchers(HttpMethod.POST, "/").permitAll()
.antMatchers(HttpMethod.GET, "/").permitAll().antMatchers(HttpMethod.POST, "/").permitAll()
.antMatchers(HttpMethod.GET, "/").permitAll().antMatchers(HttpMethod.POST, "/").permitAll()

@arashkhalesi
Have you possibly mistyped the targeted endpoint? Did you mean to /rest-module/test and not /rest-moudle/test.

Also for your security config

 .antMatchers("/**").permitAll()

I fixed the issue. I had request mapping in class level. I removed that and added to requestMapping in controller level so then issue was fixed.

@jmw5598 Thank you for helping here!