5.Spring security从当前请求对象中获取登陆用户
作者:互联网
@RequestMapping("getUser")
public void getUser(HttpServletRequest req){
String remoteUser=req.getRemoteUser();
Authentication auth=(Authentication) req.getUserPrincipal();
System.out.println("remoteUser:"+remoteUser);
System.out.println("auth.getName():"+auth.getName());
}
标签:请求,Spring,req,System,auth,Authentication,remoteUser,security,out 来源: https://www.cnblogs.com/ChuckTina/p/16381171.html