add subclass Authentication & Controller

This commit is contained in:
a-sansara 2017-03-15 10:51:09 +01:00
parent dc9d1eb851
commit 2f9994a4f4
5 changed files with 94 additions and 2 deletions

View File

@ -35,6 +35,9 @@ class Application extends App
$app['ws.authenticator'] = function ($app) { $app['ws.authenticator'] = function ($app) {
return new Authenticator($app['config']['pwsauth']); return new Authenticator($app['config']['pwsauth']);
}; };
$app['user.provider'] = function ($app) {
return null;
}
} }
/*! /*!

View File

@ -12,7 +12,7 @@ namespace MetaTech\PwsServer\Ctrl;
use Silex\Application; use Silex\Application;
use Silex\ControllerCollection; use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use MetaTech\Silex\Ws\Controller; use MetaTech\PwsServer\Ws\Controller;
/*! /*!
* @package MetaTech\PwsServer\Ctrl * @package MetaTech\PwsServer\Ctrl
* @class OtherWebService * @class OtherWebService

View File

@ -12,7 +12,7 @@ namespace MetaTech\PwsServer\Ctrl;
use Silex\Application; use Silex\Application;
use Silex\ControllerCollection; use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use MetaTech\Silex\Ws\Controller; use MetaTech\PwsServer\Ws\Controller;
/*! /*!
* @package MetaTech\PwsServer\Ctrl * @package MetaTech\PwsServer\Ctrl

View File

@ -0,0 +1,52 @@
<?php
/*
* This file is part of the silex-core package.
*
* (c) meta-tech.academy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MetaTech\PwsServer\Ws;
use Symfony\Component\HttpFoundation\Session\Session;
use MetaTech\PwsAuth\Authenticator;
use MetaTech\Silex\Ws\Authentication as BaseAuthentication;
/*!
* @package MetaTech\PwsServer\Ws
* @class Authentication
* @author a-Sansara
* @date 2017-03-15 10:42:42 CET
*/
class Authentication extends BaseAuthentication
{
/*! @protected @®ar MetaTech\PwsAuth\Authenticator $authenticator */
protected $userProvider;
/*!
* @constructor
* @public
* @param Symfony\Component\HttpFoundation\Session\Session $session
* @param MetaTech\PwsAuth\Authenticator $authenticator
*/
public function __construct(Session $session, Authenticator $authenticator, $userProvider)
{
parent::__construct($session, $authenticator);
$this->userOrovider = $userProvider;
}
/*!
* @method checkUser
* @public
* @param str $login
* @param str $password
* @param str $key
* @return bool
*/
public function checkUser($login, $password, $key)
{
// @todo implements with userProvider
return true;
}
}

View File

@ -0,0 +1,37 @@
<?php
/*
* This file is part of the pws-server package.
*
* (c) meta-tech.academy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MetaTech\PwsServer\Ws;
use Silex\Application;
use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request;
use MetaTech\Silex\Ws\Controller as BaseController;
use MetaTech\PwsServer\Ws\Authentication;
/*!
* @package MetaTech\PwsServer\Ctrl
* @class Controller
* @extends MetaTech\Silex\Ws\Controller
* @author a-Sansara
* @date 2017-03-15 10:41:57 CET
*/
class Controller extends BaseController
{
/*!
* @constrcutor
* @public
* @param Silex\Application $app
*/
public function __construct(Application $app = null)
{
$this->session = $app['session'];
$this->handler = new Authentication($this->session, $app['ws.authenticator'], $app['user.provider']);
}
}