spring-projects / spring-projects/spring-security

Populate Interface HTTP Service Clients with Authentication properties

Open
#17,940 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: web type: enhancement
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 @CurrentSecurityContext and @AuthenticationPrincipal except 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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.