懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
提交 | 用户 | 时间
e57a89 1 package com.jcdm.framework.security.context;
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 }