测试stand库修改-文档库
This commit is contained in:
+22
@@ -50,6 +50,9 @@ public class ShiroRealm extends AuthorizingRealm {
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private HttpServletResponse response;
|
||||
|
||||
// @Autowired
|
||||
// private HttpServletResponse response;
|
||||
|
||||
@@ -105,6 +108,25 @@ public class ShiroRealm extends AuthorizingRealm {
|
||||
String token = (String) auth.getCredentials();
|
||||
if (token == null) {
|
||||
log.info("————————身份认证失败——————————IP地址: "+ oConvertUtils.getIpAddrByRequest(SpringContextUtils.getHttpServletRequest()));
|
||||
String reponseJson = new Gson().toJson(Result.error(401,"token为空,请重新登录!"));
|
||||
response.setContentType("application/json; charset=utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = response.getOutputStream();
|
||||
out.write(reponseJson.getBytes());
|
||||
}catch (IOException ex){
|
||||
ex.printStackTrace();
|
||||
}finally {
|
||||
if(out != null){
|
||||
try {
|
||||
out.close();
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
LoginException.loginException(401,"token为空");
|
||||
//throw new JeroBootException("token为空!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user