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.
29 lines
949 B
29 lines
949 B
package org.ros.chatto.logged;
|
|
|
|
import java.io.IOException;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
import org.springframework.security.core.Authentication;
|
|
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
@Component("myAuthenticationSuccessHandler")
|
|
public class UserSessionLoggingLoginSuccessHandler
|
|
implements AuthenticationSuccessHandler {
|
|
|
|
@Override
|
|
public void onAuthenticationSuccess(HttpServletRequest request,
|
|
HttpServletResponse response, Authentication authentication)
|
|
throws IOException {
|
|
HttpSession session = request.getSession(false);
|
|
if (session != null) {
|
|
UserLoggingSessionListener user = new UserLoggingSessionListener(
|
|
authentication.getName());
|
|
session.setAttribute("user", user);
|
|
}
|
|
response.sendRedirect("/chat");
|
|
}
|
|
}
|