leisure.springboot.web.util.UserInfoHttp Maven / Gradle / Ivy
The newest version!
package leisure.springboot.web.util;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
public class UserInfoHttp {
public static String getUserId(HttpServletRequest request) {
Object ouser = request.getAttribute("user");
if (ouser != null) {
Map maps = (Map) (ouser);
String uid = String.valueOf(maps.get("uid"));
return uid;
}
return null;
}
}