Skip to content
Snippets Groups Projects
Commit 8ad7b505 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Close the browser window on the SSO success page

HTML/JavaScript code is output by the SuccessHandler to close the
browser window if SSO login was opened in a popup.
parent 334546cd
No related merge requests found
......@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
......@@ -68,6 +69,8 @@ public class LoginAuthenticationSucessHandler extends
cookie.setSecure(request.isSecure());
cookie.setHttpOnly(true);
response.addCookie(cookie);
response.setContentType(MediaType.TEXT_HTML_VALUE);
response.getWriter().println("<!DOCTYPE html><script>if (window.opener) window.close()</script>");
return;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment