forked from pzk9h3i5c/c7-523
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
995 B
27 lines
995 B
package com.qsd.orange.security;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import com.qsd.orange.global.R;
|
|
import org.springframework.security.core.Authentication;
|
|
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import javax.servlet.ServletException;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.IOException;
|
|
|
|
@Controller
|
|
public class LoginSuccessHandler implements AuthenticationSuccessHandler {
|
|
|
|
@Override
|
|
public void onAuthenticationSuccess(HttpServletRequest request,
|
|
HttpServletResponse response,
|
|
Authentication authentication) throws IOException, ServletException {
|
|
response.setCharacterEncoding("utf-8");
|
|
response.setContentType("application/json;charset=utf-8");
|
|
response.getWriter().print(JSONUtil.toJsonStr(R.success()));
|
|
}
|
|
|
|
}
|