tomekkup.helenos.security.web.authentication.JsonLogoutSuccesHandler.java Source code

Java tutorial

Introduction

Here is the source code for tomekkup.helenos.security.web.authentication.JsonLogoutSuccesHandler.java

Source

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tomekkup.helenos.security.web.authentication;

import java.io.IOException;
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.logout.LogoutSuccessHandler;
import org.springframework.stereotype.Component;

/**
 * ********************************************************
 * Copyright: 2012 Tomek Kuprowski
 *
 * License: GPLv2: http://www.gnu.org/licences/gpl.html
 *
 * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
 * *******************************************************
 */
@Component("jsonLogoutSuccessHandler")
public class JsonLogoutSuccesHandler extends AbstractJsonAuthenticationHandler implements LogoutSuccessHandler {

    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
            Authentication authentication) throws IOException, ServletException {
        logger.debug(String.format("user '%s' logged out", authentication.getName()));
        writeResult(response, null);
    }

}