package cn.reghao.oss.console.util;

/**
 * @author reghao
 * @date 2023-06-02 10:48:59
 */
public class AuthKeyContext implements AutoCloseable {
    static final ThreadLocal<Integer> CURRENT = new ThreadLocal<>();

    public AuthKeyContext(Integer user) {
        CURRENT.set(user);
    }

    public static int getUser() {
        return CURRENT.get();
    }

    @Override
    public void close() {
        CURRENT.remove();
    }
}
