Changeset cb39a77 for src


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
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/apigility/config/modules.config.php

    r74c3571 rcb39a77  
    66 */
    77return [
     8    'Zend\Session',
    89    'Zend\\Db',
    910    'Zend\\Filter',
  • 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}
  • src/webapp/apigility/module/gnuboat_mapservice/config/module.config.php

    r74c3571 rcb39a77  
    239239    ],
    240240    'zf-mvc-auth' => [
     241                'authentication' => [
     242                'map' => [
     243                                'gnuboat_mapservice\\V1'  => 'gnuboat-oauth',
     244                                'ZF\\OAuth2' => 'session',
     245                        ],
     246                ],
    241247        'authorization' => [
    242248            'gnuboat_mapservice\\V1\\Rest\\Waters\\Controller' => [
    … …  
    257263            ],
    258264        ],
     265        'session' => [
     266                        'adapter' => 'Application\\Authentication\\Adapter\\SessionAdapter',
     267                ],
    259268    ],
    260269];
Note: See TracChangeset for help on using the changeset viewer.