spring-projects / spring-projects/spring-graphql
Add support for @WithMockUser to WebGraphQlTester
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 336
- PR merge metrics
- No merged PRs in 30d
Description
We currently use the annotation @WithMockUser to impersonate a user with a specific role in our integration tests.
The WebGraphQlTester only allows for basic or bearer auth headers, so for right now, we can't create any test cases for our internal api.
Maybe there is a way currently to get the WebGraphQlTester to use the test security context overridden by WithMockUserSecurityContextFactory?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading WebGraphQlTester and the WithMockUserSecurityContextFactory mentioned in the issue, then trace how the tester currently applies basic or bearer authentication. Determine how the test security context should be used for @WithMockUser. Done means integration tests can exercise an internal GraphQL API with the mocked user and role.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, java, spring
- Domain
- api, authentication, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100