irto / oauth2-proxy

此包最新版本(dev-master)没有提供许可证信息。

用于创建安全Web应用的OAuth2 API代理的PHP代理。

dev-master 2016-02-05 18:46 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:06:46 UTC


README

oauth2-proxy

用于创建安全Web应用的OAuth2 API代理的PHP代理。

此项目将帮助创建基于OAuth2 API的Web应用,工作方式类似于使用CSRF和Session作为前端代理(或翻译器),并将OAuth2翻译到后端API。项目基于出色的ReactPHP库和Illuminate(来自Laravel)组件。

示例 example\server.php

<?php

require '../vendor/autoload.php';

$proxy = Irto\OAuth2Proxy\Server::create(array(
    'api_url' => 'http://api.web.domain',
    'port' => 8080,
    'client_id' => 'e22aa202216e86c42beac80f9a6ac2da505dc',
    'client_secret' => '471d2e22aa202216e86c42beac80f9a6ac2da5',
    'grant_path' => '/auth/token',
    'revoke_path' => '/auth/revoke',
    'grant_type' => 'client_grant',

    'session' => [
        'driver' => 'file',
        'folder' => '../storage/sessions/',
        'name' => 'tests',
        'path' => '/',
        'domain' => 'web.domain',
        'lifetime' => 3600,
    ]
        
));

$proxy->run();

?>

运行很简单

    $ php ./server.php

...或使用nohup在后台运行

    $ nohup php ./server.php &

待办事项

  • 单元测试
  • OAuth2授权流程
  • 友好的配置
  • 文档(我的英语很糟糕 .-.)