Spring Security and @Async (Authenticated Users mixed up)

后端 未结 6 567
离开以前
离开以前 2020-11-27 13:03

I asynchronously invoke method with Spring, using @Async.This method invokes other method annotated with @PreAuthorize, Spring Security Annotation. To make authorization wor

6条回答
  •  我在风中等你
    2020-11-27 13:22

    Based on @Ralph answer one can achieve Aync event with Spring with threadpooling and delegate the security using http://docs.spring.io/autorepo/docs/spring-security/4.0.0.M1/apidocs/org/springframework/security/task/DelegatingSecurityContextAsyncTaskExecutor.html

    Sample code

    
        
            
        
    
    
    
    
    
    
    
        
    
    

提交回复
热议问题