<?php

require_once dirname(__FILE__) . '/../src/OAuth2/Autoloader.php';
OAuth2_Autoloader::register();
// register test classes
OAuth2_Autoloader::register(dirname(__FILE__));
<?php

/**
 * Created by PhpStorm.
 * User: MartinTiefengrabner
 * Date: 16/07/15
 * Time: 09:03
 */
namespace API\Middleware;

require_once 'vendor/bshaffer/oauth2-server-php/src/OAuth2/Autoloader.php';
\OAuth2_Autoloader::register();
class SSC_OAuth2_GrantType_UserCredentials implements \OAuth2_GrantTypeInterface
{
    private $storage;
    private $userInfo;
    public function __construct(\OAuth2_Storage_UserCredentialsInterface $storage)
    {
        $this->storage = $storage;
    }
    public function getQuerystringIdentifier()
    {
        return 'password';
    }
    public function validateRequest(\OAuth2_RequestInterface $request, \OAuth2_ResponseInterface $response)
    {
        if (!$request->request("password") || !$request->request("email")) {
            $response->setError(400, 'invalid_request', 'Missing parameters: "email" and "password" required');
            return null;
        }
        if (!$this->storage->checkUserCredentials($request->request("email"), $request->request("password"))) {
<?php

require_once dirname(__FILE__) . '/../src/OAuth2/Autoloader.php';
OAuth2_Autoloader::register();
// register test classes
OAuth2_Autoloader::register(dirname(__FILE__) . '/lib');
Beispiel #4
0
 public static function initService()
 {
     OAuth2_Autoloader::register();
 }