Skip to content

Unit test boot 3#48

Open
ch4mpy wants to merge 2 commits intothomasdarimont:mainfrom
ch4mpy:unit-test-boot-3
Open

Unit test boot 3#48
ch4mpy wants to merge 2 commits intothomasdarimont:mainfrom
ch4mpy:unit-test-boot-3

Conversation

@ch4mpy
Copy link
Copy Markdown
Contributor

@ch4mpy ch4mpy commented Feb 8, 2023

Add some unit-tests for access-control rules on the only endpoint of the application: /api/users/me.

This tests enlight that the Require the role "ACCESS" for all api paths is not implemented (probably a regression when moving from hasAuthority() to access()). This perfectly illustrates the value of such tests.

As those access control rules are very simple, this is quickly tested.

As most production security implementations involve at some access-rules based on authorities, it could be worth adding some RBAC to this application.

@ch4mpy
Copy link
Copy Markdown
Contributor Author

ch4mpy commented Feb 17, 2023

@thomasdarimont I added a commit to:

  • fix the AccessController so that it implements the access-control rule described in WebSecurityConfig javadoc ("Require the role "ACCESS" for all api paths")
  • update unit tests accordingly
  • add integration tests (enrich the existing @SpringBootTest)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant