Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failed on a Resource server when using Spring WebMvc RouterFunction #9

Closed
hantsy opened this issue Apr 20, 2021 · 2 comments
Closed
Assignees
Labels
invalid This doesn't seem right

Comments

@hantsy
Copy link

hantsy commented Apr 20, 2021

I created a Resource server example project using Spring WebMvc RouterFunction and Auth0 IDP.

https://github.com/hantsy/spring-webmvc-auth0-sample

When adding tests, I followed the Spring Security Samples.

I tried to use @MockMvc to test the functionality but failed. The @MockMvc can not recognize RouterFunction bean and the new Spring Security Servlet SecurityFilterChain.

Then I created a MockMvc from WebApplicationContext, check https://github.com/hantsy/spring-webmvc-auth0-sample/blob/master/src/test/java/com/example/demo/ApplicationTests.java, but failed due to an exception.

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException: Cannot invoke "org.springframework.test.web.servlet.DefaultMvcResult.setHandler(Object)" because "mvcResult" is null

    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)

Also posted on stackoverflow, https://stackoverflow.com/questions/67171628/resource-server-test-failes-with-auth0-issuer-uri

@rwinch
Copy link
Member

rwinch commented Apr 20, 2021

Thanks for getting in touch, but this does not appear to be a problem with the code in this repository as it is working. I think this question is better suited for StackOverflow which I and the rest of the security team monitors

@rwinch rwinch closed this as completed Apr 20, 2021
@rwinch rwinch self-assigned this Apr 20, 2021
@rwinch rwinch added the invalid This doesn't seem right label Apr 20, 2021
@jzheaux
Copy link
Contributor

jzheaux commented Apr 20, 2021

Hi, @hantsy, thanks for the report. I've posted a response to your StackOverflow question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants