1: <?php
2: namespace Mapbender\Component;
3:
4: use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
5: use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
6: use Symfony\Component\HttpFoundation\Request;
7: use Symfony\Component\HttpFoundation\RedirectResponse;
8:
9: class UrlSessionLoginHandler implements AuthenticationSuccessHandlerInterface {
10: 11: 12: 13: 14:
15: public function __construct(array $options = array()) {}
16:
17: 18: 19: 20: 21: 22: 23: 24: 25:
26: function onAuthenticationSuccess(Request $request, TokenInterface $token) {
27: $session = $request->getSession();
28:
29: $url = $session->get('_security.target_path');
30: $session->remove('_security.target_path');
31:
32: $url = UrlHelper::setParameters($url, array(
33: session_name() => $session->getId()));
34:
35: return new RedirectResponse($url);
36: }
37: }
38: