All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.shawven.security.app.AppLogoutSuccessHandler Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version

package com.github.shawven.security.app;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.shawven.security.authorization.Responses;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 默认的退出成功处理器
 *
 * @author Shoven
 * @since 2019-05-08 21:54
 */
public class AppLogoutSuccessHandler implements LogoutSuccessHandler {

	@Override
	public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
			throws IOException {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("application/json;charset=UTF-8");
        response.getWriter().write(new ObjectMapper().writeValueAsString(Responses.loginOutSuccess()));
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy