添加角色相关的接口,用户信息添加角色信息
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user