Overview

Namespaces

  • Mapbender
    • Component
      • HTTP
    • CoreBundle
      • Command
      • Component
        • Exception
      • Controller
      • DataFixtures
        • ORM
      • DependencyInjection
      • Element
        • Type
      • Entity
      • EventListener
      • Extension
      • Form
        • DataTransformer
        • EventListener
        • Type
      • Security
      • Template
    • DrupalIntegrationBundle
      • DependencyInjection
      • Security
        • Authentication
          • Provider
          • Token
        • Authorization
          • Voter
        • Factory
        • Firewall
        • User
      • Session
    • KmlBundle
      • Element
    • ManagerBundle
      • Controller
      • Form
        • DataTransformer
        • Type
    • MonitoringBundle
      • Command
      • Component
      • Controller
      • DependencyInjection
      • Entity
      • EventListener
      • Form
    • PrintBundle
      • Component
      • Controller
    • WmcBundle
      • Component
        • Exception
      • Element
        • Type
      • Entity
      • Form
        • EventListener
        • Type
    • WmsBundle
      • Component
        • Exception
      • Controller
      • DependencyInjection
      • Element
        • Type
      • Entity
      • Event
      • Form
        • EventListener
        • Type
    • WmtsBundle
      • Component
        • Exception
      • Controller
      • Entity
      • Form
        • Type
  • None
  • PHP

Classes

  • CustomDoctrineParamConverter
  • Ldap
  • UrlHelper
  • UrlSessionFormEntryPoint
  • UrlSessionLoginHandler
  • UrlSessionRedirectListener
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
 1: <?php
 2: 
 3: namespace Mapbender\Component;
 4: namespace Mapbender\Component;
 5: 
 6: use Symfony\Component\Security\Core\Exception\AuthenticationException;
 7: use Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint;
 8: use Symfony\Component\HttpFoundation\Request;
 9: use Symfony\Component\HttpFoundation\RedirectResponse;
10: use Symfony\Component\Security\Http\HttpUtils;
11: use Symfony\Component\HttpKernel\HttpKernelInterface;
12: 
13: class UrlSessionFormEntryPoint extends FormAuthenticationEntryPoint {
14:     private $loginPath;
15:     private $useForward;
16:     private $httpKernel;
17:     private $httpUtils;
18: 
19:     public function __construct(HttpKernelInterface $kernel, HttpUtils $httpUtils, $loginPath, $useForward = false) {
20:         $this->httpKernel = $kernel;
21:         $this->httpUtils = $httpUtils;
22:         $this->loginPath = $loginPath;
23:         $this->useForward = (Boolean) $useForward;
24: 
25:         parent::__construct($kernel, $httpUtils, $loginPath, $useForward);
26:     }
27: 
28:     /**
29:      * {@inheritdoc}
30:      */
31:     public function start(Request $request,
32:         AuthenticationException $authException = null) {
33: 
34:         if ($this->useForward) {
35:             $subRequest = $this->httpUtils->createRequest($request,
36:                 $this->loginPath);
37: 
38:             return $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
39:         }
40: 
41:         $response = $this->httpUtils->createRedirectResponse($request, $this->loginPath);
42:         $url = $response->headers->get('location');
43:         $delim = strpos($url, '?') === False ? '?' : '&';
44:         $sid = session_name() . '=' . $request->getSession()->getId();
45:         $url .= $delim . $sid;
46: 
47:         return new RedirectResponse($url);
48:     }
49: }
50: 
51: 
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0