spring-projects / spring-projects/spring-security

Expose TestOidcUsers and similar to help unit testing in related project

Open
#13,628 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: enhancement
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Expected Behavior

Spring security test cases make extensive use of TestOidcUsers.create() and similar classes.

see https://github.com/spring-projects/spring-security/blob/d35b38e/oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/TestOidcUsers.java#L33

However, the utility classes are test scope only, so I cannot directly use them for testing in my own projects.

This is pretty annoying. I know I can copy classes from spring-security test-source but it is a temporary workaround which is brittle, as spring-security classes change between releases.

Instead, I would prefer to depend on a test-only package.

  1. is it possible to create and release a test util package for spring security (or spring-security-oauth2)?
  2. if yes, what size of effort would it take from the team to make that happen?

is it already possible to achieve what I am trying to do today, then please guide me

Thanks for your understanding 👍

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with oauth2/oauth2-core/src/test/java/org/springframework/security/oauth2/core/oidc/user/TestOidcUsers.java and review TestOidcUsers.create() alongside the similar test utilities mentioned. Determine the scope and packaging requirements for making these utilities usable by external projects; done means a supported test-only dependency path is defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.