package com.jiayue.ipfcst.common.security.util;

import lombok.experimental.UtilityClass;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * SecurityUtil
 *
 * @author L.ym
 * @version 3.0
 **/
@UtilityClass
public class SecurityUtil {
    /**
     * 获取当前登录用户的账号名
     *
     * @param
     * @return java.lang.String
     * @author L.ym
     * @date 2020/2/14
     **/
    public String getCurrentAccount() {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return String.valueOf(authentication.getPrincipal());
    }
}
