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

  • DrupalProvider
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
 1: <?php
 2: 
 3: namespace Mapbender\DrupalIntegrationBundle\Security\Authentication\Provider;
 4: 
 5: use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
 6: use Symfony\Component\Security\Core\User\UserProviderInterface;
 7: use Symfony\Component\Security\Core\Exception\AuthenticationException;
 8: use Symfony\Component\Security\Core\Exception\NonceExpiredException;
 9: use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
10: use Mapbender\DrupalIntegrationBundle\Authentication\Token\DrupalUserToken;
11: 
12: 
13: class DrupalProvider implements AuthenticationProviderInterface
14: {
15:     private $userProvider;
16:     private $cacheDir;
17: 
18:     public function __construct(UserProviderInterface $userProvider)
19:     {
20:         $this->userProvider = $userProvider;
21:     }
22: 
23:     public function authenticate(TokenInterface $token)
24:     {
25:         $user = $this->userProvider->loadUserByUsername($token->getUsername());
26: 
27:         $authenticatedToken = new DrupalUserToken($user->getRoles());
28:         $authenticatedToken->setUser($user);
29: 
30:         return $authenticatedToken;
31:     }
32: 
33:     public function supports(TokenInterface $token)
34:     {
35:         return $token instanceof DrupalUserToken;
36:     }
37: }
38: 
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0