添加角色相关的接口,用户信息添加角色信息

This commit is contained in:
648540858
2021-08-10 15:42:15 +08:00
parent dbc525e8fb
commit 9e8cab609d
29 changed files with 598 additions and 134 deletions

View File

@@ -28,8 +28,8 @@ public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoi
response.setHeader("Access-Control-Allow-Headers", "token, Accept, Origin, X-Requested-With, Content-Type, Last-Modified");
response.setHeader("Content-type", "application/json;charset=UTF-8");
JSONObject jsonObject = new JSONObject();
jsonObject.put("msg", e.getMessage());
jsonObject.put("code", "-1");
jsonObject.put("msg", "请登录后重新请求");
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
try {
response.getWriter().print(jsonObject.toJSONString());

View File

@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.conf.security.dto;
import com.genersoft.iot.vmp.storager.dao.dto.Role;
import com.genersoft.iot.vmp.storager.dao.dto.User;
import org.springframework.security.core.CredentialsContainer;
import org.springframework.security.core.GrantedAuthority;
@@ -93,8 +94,8 @@ public class LoginUser implements UserDetails, CredentialsContainer {
return user.getId();
}
public int getRoleId() {
return user.getRoleId();
public Role getRole() {
return user.getRole();
}