for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the HRis Software package.
*
* NOTICE OF LICENSE
* Licensed under the 3-clause BSD License.
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file.
* @version alpha
* @author Bertrand Kintanar <[email protected]>
* @license BSD License (3-clause)
* @copyright (c) 2014-2016, b8 Studios, Ltd
* @link http://github.com/HB-Co/HRis
*/
namespace HRis\Api\Controllers\Auth\OAuth;
use Exception;
use Irradiate\Api\Controllers\BaseController;
use LucaDegasperi\OAuth2Server\Authorizer;
use Symfony\Component\HttpFoundation\Response;
class Controller extends BaseController
{
/**
* @var Authorizer
protected $authorizer;
* OAuthController constructor.
* @param Authorizer $authorizer
public function __construct(Authorizer $authorizer)
$this->authorizer = $authorizer;
}
* @return array
public function accessToken()
try {
return $this->authorizer->issueAccessToken();
} catch (Exception $e) {
return $this->responseAPI(Response::HTTP_UNAUTHORIZED, 'Forbidden');