中国算力平台算力登记系统2.0
yanzhaofeige
6 days ago d16b55507ee921564c75032e46759bbea1b77455
commit | author | age
43dc29 1 package com.odcc.cpzidc.framework.security.context;
Y 2
3 import org.springframework.security.core.Authentication;
4
5 /**
6  * 身份验证信息
7  * 
8  * @author ruoyi
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 }