spring security在异步线程的处理

https://spring.io/guides/topicals/spring-security-architecture

在异步线程中使用SecurityContextHolder , 需要将父线程的securityConext传播到异步线程中,

实现方式是使用spring提供的一个代理线程池DelegatingSecurityContextExecutorService 来执行异步任务


filter中的认证机制主要是为了控制是否需要登录, method上的认证机制是更细粒度的角色控制
与shiro相似,web filter虽然只有一个,但是这个filter本身里又包装了多个security filter


在service层中也可以使用注解, 关键是要经过method interceptor,
service内部自身调用还会经过这个拦截吗?

posted @ 2019-09-08 00:41  funny_coding  阅读(1232)  评论(0编辑  收藏  举报
build beautiful things, share happiness