首页>代码>SSM和Spring Security的整合后台权限基础框架>/mis/src/main/java/com/haoyu/security/MyAuthenticationSuccessHandler.java
package com.haoyu.security;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
public class MyAuthenticationSuccessHandler implements AuthenticationSuccessHandler{
//jackson工具类
private ObjectMapper objectMapper = new ObjectMapper();
/**
* authentication:代表认证成功后的信息
*/
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
//返回json字符串
Map result = new HashMap();
result.put("success", true);
String json = objectMapper.writeValueAsString(result);
response.setContentType("text/json;charset=utf-8");
response.getWriter().write(json);
}
}
最近下载更多
15719908287 LV10
2024年11月1日
微信网友_7134912998903808 LV15
2024年9月14日
taoshen95 LV16
2024年5月15日
ewan007 LV30
2023年7月4日
liaozhenlei LV8
2022年6月7日
ssnqqq LV3
2022年4月10日
wubinbin LV11
2022年4月3日
jay1992 LV14
2022年1月17日
tiansitong LV14
2021年12月5日
17704627276 LV17
2021年11月30日
最近浏览更多
微信网友_7826662819680256
2025年12月24日
暂无贡献等级
15719908287 LV10
2024年11月1日
微信网友_7134912998903808 LV15
2024年9月14日
TY0165 LV20
2024年6月24日
taoshen95 LV16
2024年5月15日
minjing123 LV8
2024年1月4日
iiiiiiixiiiiii LV1
2023年12月31日
shuangfu LV25
2023年12月2日
Hachi6 LV13
2023年8月17日
ewan007 LV30
2023年7月4日

