Java tutorial
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.AuthenticationSuccessHandler; 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("jsonAuthenticationSuccessHandler") public class JsonAuthenticationSuccessHandler extends AbstractJsonAuthenticationHandler implements AuthenticationSuccessHandler { @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { logger.debug(String.format("user '%s' logged in successfully", authentication.getName())); writeResult(response, authentication); } }