package com.lij.himeeter.framework.security.context;

import org.springframework.security.core.Authentication;

/**
 * <pre>
 *
 * 文件名 :  AuthenticationContextHolder
 * 创建时间 : 2025年01月06日 03:30
 *
 * 文件描述 : 身份验证信息
 *
 * </pre>
 *
 * @author Nobita
 * @version 1.0.0
 */

public class AuthenticationContextHolder {

    private static final ThreadLocal<Authentication> contextHolder = new ThreadLocal<>();

    public static Authentication getContext() {
        return contextHolder.get();
    }

    public static void setContext(Authentication context) {
        contextHolder.set(context);
    }

    public static void clearContext() {
        contextHolder.remove();
    }
}
