|
|
|
@ -118,7 +118,16 @@ public class LoginController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
passWord = jwtUser.getPassword();
|
|
|
|
passWord = jwtUser.getPassword();
|
|
|
|
userName = jwtUser.getStudentId();
|
|
|
|
userName = jwtUser.getUsername();
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(userName)){
|
|
|
|
|
|
|
|
userName = jwtUser.getUsername();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(userName)){
|
|
|
|
|
|
|
|
userName = jwtUser.getName();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!org.springframework.util.StringUtils.hasText(passWord)) {
|
|
|
|
if (!org.springframework.util.StringUtils.hasText(passWord)) {
|
|
|
|
throw new UnAuthorizedException("token 中缺少用户密码信息!");
|
|
|
|
throw new UnAuthorizedException("token 中缺少用户密码信息!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -128,7 +137,8 @@ public class LoginController {
|
|
|
|
if (jwtUser == null) {
|
|
|
|
if (jwtUser == null) {
|
|
|
|
throw new UnAuthorizedException("登录失败,用户不存在!");
|
|
|
|
throw new UnAuthorizedException("登录失败,用户不存在!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (jwtUser.getRoleId()==4)
|
|
|
|
|
|
|
|
{
|
|
|
|
Date authorizeTime = jwtUser.getAuthorizeTime();
|
|
|
|
Date authorizeTime = jwtUser.getAuthorizeTime();
|
|
|
|
Date authorizeEndTime = jwtUser.getAuthorizeEndTime();
|
|
|
|
Date authorizeEndTime = jwtUser.getAuthorizeEndTime();
|
|
|
|
|
|
|
|
|
|
|
|
@ -140,6 +150,8 @@ public class LoginController {
|
|
|
|
if (now.before(authorizeTime) || now.after(authorizeEndTime)) {
|
|
|
|
if (now.before(authorizeTime) || now.after(authorizeEndTime)) {
|
|
|
|
throw new UnAuthorizedException("系统授权已过期!");
|
|
|
|
throw new UnAuthorizedException("系统授权已过期!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Authentication authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());
|
|
|
|
Authentication authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());
|
|
|
|
SecurityContextHolder.getContext().setAuthentication(authentication);
|
|
|
|
SecurityContextHolder.getContext().setAuthentication(authentication);
|
|
|
|
|