UserUtils.java
785 Bytes
package com.glsx.common.utils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.glsx.common.constants.Constants;
/**
*
* @Title UserUtils.java
* @Package com.qurong.credit.sp.utils
* @Description TODO 获取当前用户工具类
* @author zhanghj
* @date 2018年7月16日 下午4:35:03
* @version
*/
public class UserUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(UserUtils.class.getName());
public static String getUserName(HttpServletRequest request) {
HttpSession session = request.getSession();
String username = (String) session.getAttribute(Constants.SESSION_USERNAME_KEY);
return username;
}
}