You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Federico Mariani (Jira)" <ji...@apache.org> on 2025/03/20 13:22:00 UTC
[jira] [Created] (CAMEL-21887) camel-platform-http-starter - Add support for Spring security context injection
Federico Mariani created CAMEL-21887:
----------------------------------------
Summary: camel-platform-http-starter - Add support for Spring security context injection
Key: CAMEL-21887
URL: https://issues.apache.org/jira/browse/CAMEL-21887
Project: Camel
Issue Type: Improvement
Reporter: Federico Mariani
Spring Boot does not support Principal/ContextSecurity Injection in Async method.
Though it is possible by configuring a _DelegatingSecurityContextAsyncTaskExecutor_ that is a wrapper around a _ThreadPoolTaskExecutor_.
Camel platform http starter at the moment only supports _ThreadPoolTaskExecutor_ and _SimpleAsyncTaskExecutor_. Support for _DelegatingSecurityContextAsyncTaskExecutor_ has to be added and this implementation should be prioritized.
Once done, it will be possible to do the following:
* Configure spring security following standards
* configure the wrapper as:
{code:java}
@Bean
public DelegatingSecurityContextAsyncTaskExecutor springSecurityTaskExecutorIntegration(ThreadPoolTaskExecutor taskExecutor) {
return new DelegatingSecurityContextAsyncTaskExecutor(taskExecutor);
}
{code}
* Finally _SecurityContextHolder.getContext().getAuthentication().getName()_ (in a bean or a processor) will contain the authenticated user name.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)