wujian
2024-02-22 268beb4ebc1e5b8d4ad715b71cd64a0944073a87
提交 | 用户 | 时间
268beb 1 package com.jcdm.framework.security.context;
W 2
3 import org.springframework.security.core.Authentication;
4
5 /**
6  * 身份验证信息
7  * 
8  * @author jc
9  */
10 public class AuthenticationContextHolder
11 {
12     private static final ThreadLocal<Authentication> contextHolder = new ThreadLocal<>();
13
14     public static Authentication getContext()
15     {
16         return contextHolder.get();
17     }
18
19     public static void setContext(Authentication context)
20     {
21         contextHolder.set(context);
22     }
23
24     public static void clearContext()
25     {
26         contextHolder.remove();
27     }
28 }