Ignore:
Timestamp:
Feb 17, 2019, 4:40:52 PM (8 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
3a89adb
Parents:
74c3571
Message:

Trying user identification with oauth

Location:
src/webapp/apigility/module/Application/src
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/apigility/module/Application/src/Module.php

    r74c3571 rcb39a77  
    33 * @license   http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
    44 * @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
     5 *
     6 * partly copied from https://apigility.org/documentation/auth/user-differentiation
    57 */
    68
    79namespace Application;
     10
     11use ZF\MvcAuth\Authentication\DefaultAuthenticationListener;
     12use Zend\EventManager\EventInterface;
     13use ZF\MvcAuth\MvcAuthEvent;
    814
    915class Module
    … …  
    1319        return include __DIR__ . '/../config/module.config.php';
    1420    }
     21   
     22    public function onBootstrap(EventInterface $e)
     23    {
     24        $app       = $e->getApplication();
     25        $container = $app->getServiceManager();
     26
     27        // Add Authentication Adapter for session
     28        $defaultAuthenticationListener = $container->get(DefaultAuthenticationListener::class);
     29        $defaultAuthenticationListener->attach(new Authentication\SessionAdapter());
     30       
     31        // Add Authorization
     32                $eventManager = $app->getEventManager();
     33                $eventManager->attach(
     34                        MvcAuthEvent::EVENT_AUTHORIZATION,
     35                        new Authorization\AuthorizationListener(),
     36                        100
     37                );
     38    }
    1539}
Note: See TracChangeset for help on using the changeset viewer.