package org.springblade.common.auth.permission;

import org.springblade.common.auth.support.Application;

/**
 * @author caiyihua
 */
public class PermissionContextUtil {

    private static ThreadLocal<Application> context = new ThreadLocal<Application>() {
        @Override
        protected Application initialValue() {
            return null;
        }
    };

    public static void setCurrentApplication(Application application) {
        context.set(application);
    }

    public static Application getCurrentApplication() {
        return context.get();
    }

    public static void clearCurrentApplication() {
        context.set(null);
    }
}
