PHP code example of lookyman / nette-oauth2-server-doctrine
1. Go to this page and download the library: Download lookyman/nette-oauth2-server-doctrine library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lookyman / nette-oauth2-server-doctrine example snippets
class RouterFactory
{
/**
* @return IRouter
*/
public static function createRouter()
{
$router = new RouteList();
$router[] = new Route('oauth2/<action>', 'NetteOAuth2Server:OAuth2:default');
// ...
return $router;
}
}
class ApprovePresenter extends Presenter
{
use ApprovePresenterTrait;
// ...
public function actionDefault()
{
$this['approve'];
}
}
class ApprovePresenter extends Presenter
{
use ApprovePresenterTrait {
createComponentApprove as ___createComponentApprove;
}
// ...
/**
* @return ApproveControl
*/
protected function createComponentApprove()
{
$control = $this->___createComponentApprove();
$control->setTemplateFile(__DIR__ . '/path/to/template.latte');
return $control;
}
}
class SecretValidator
{
public function __invoke($expected, $actual)
{
return password_verify($actual, $expected);
}
}
class CredentialsValidator
{
public function __invoke($username, $password, $grantType, ClientEntityInterface $clientEntity)
{
// get the user ID from your application, and
return new UserEntity($userId);
}
}
class ScopeFinalizer
{
public function __invoke(array $scopes, $grantType, ClientEntityInterface $clientEntity, $userIdentifier)
{
return $scopes; // this is the default behavior
}
}
sh
php www/index.php orm:schema-tool:update --force
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.