spring-security icon indicating copy to clipboard operation
spring-security copied to clipboard

Consider adding `PrincipalResolver` to `ExchangeFilterFunctions`

Open sjohnr opened this issue 1 year ago • 4 comments

We should align (Server|Servlet)OAuth2AuthorizedClientExchangeFilterFunction with OAuth2ClientHttpRequestInterceptor which introduces a PrincipalResolver as a flexible strategy for resolving the Authentication for a given request.

For ServletOAuth2AuthorizedClientExchangeFilterFunction, the interface could be:

@FunctionalInterface
public interface PrincipalResolver {

	@Nullable
	Authentication resolve(ClientRequest request);

}

For ServerOAuth2AuthorizedClientExchangeFilterFunction, it may need to return a Mono<Authentication> to accommodate ReactiveSecurityContextHolder:

@FunctionalInterface
public interface PrincipalResolver {

	@Nullable
	Mono<Authentication> resolve(ClientRequest request);

}

sjohnr avatar Dec 13 '24 17:12 sjohnr

Hi, @sjohnr can I work on this?

evgeniycheban avatar Apr 21 '25 00:04 evgeniycheban

@evgeniycheban Are you still interested on working on this?

jgrandja avatar Jun 11 '25 20:06 jgrandja

Hi @jgrandja, yes, you can assign it to me, however at the moment I'm working on gh-17188, I will submit a draft solution in a few days so we can discuss it further.

evgeniycheban avatar Jun 11 '25 20:06 evgeniycheban

Thanks and no rush @evgeniycheban. I have quite a bit going on now.

jgrandja avatar Jun 11 '25 20:06 jgrandja