spring-projects / spring-projects/spring-security
Populate Interface HTTP Service Clients with Authentication properties
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
It would be nice if we could provide a flexible way to populate the Interface HTTP Service Clients with information from the Authentication. For example, consider a request that wants to get the currently logged in users profile:
@GetExchange("/users/{currentUsername}/profile")
UserProfile getCurrentUserProfile();
It would be nice if we could provide a flexible way to map Spring Security's Authentication.getName() to the currentUsername path variable.
A few notes:
- I believe this should probably be possible as a Spring Security extension with the current APIs, but need to investigate it further.
- We would probably want to use SpEL to map the property
- The support would look fairly similar to
@CurrentSecurityContextand@AuthenticationPrincipalexcept that we would not necessarily have an argument to put it on. - This is also similar to the Spring Security + Spring Data Integration
- I'd like to see this in the 7.0.x timeline, but it is likely to slip to 7.1.x
cc @rstoyanchev
Contributor guide
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
No files, tests, or entry points are named. Start by investigating whether current Spring Security APIs can support mapping Authentication.getName() into an HTTP service client's path variable, comparing the behavior of @CurrentSecurityContext and @AuthenticationPrincipal. Done should include a decided SpEL-based design and support for the currentUsername example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, authentication
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100