openpp / oauth-server-bundle
Symfony OpenppOAuthServerBundle
该包的官方仓库似乎已消失,因此该包已被冻结。
Requires
This package is not auto-updated.
Last update: 2023-02-10 14:09:15 UTC
README
安装
- 使用 composer 下载 OpenppOAuthServerBundle
- 启用包
- 配置依赖包
- 配置 OpenppOAuthServerBundle
- 扩展 OpenppOAuthServerBundle
步骤 1:使用 composer 下载 OpenppOAuthServerBundle
使用 composer 需求该包
$ composer require openpp/oauth-server-bundle "0.1.*"
Composer 会将包安装到项目的 vendor/openpp/oauth-server-bundle
目录。
$ composer require sonata-project/doctrine-orm-admin-bundle "2.3.*"
Composer 会将包安装到项目的 vendor/sonata-project/doctrine-orm-admin-bundle
目录。
步骤 2:启用包
在内核中启用包:
// app/AppKernel.php class AppKernel { public function registerBundles() { $bundles = array( // ... new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Sonata\CoreBundle\SonataCoreBundle(), new Sonata\BlockBundle\SonataBlockBundle(), new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(), new Sonata\AdminBundle\SonataAdminBundle(), new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(), new FOS\UserBundle\FOSUserBundle(), new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'), new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle(), new FOS\OAuthServerBundle\FOSOAuthServerBundle(), new Openpp\OAuthServerBundle\OpenppOAuthServerBundle(), // ... ); }
步骤 3. 配置依赖包
配置 SonataCoreBundle
https://sonata-project.org/bundles/core/master/doc/reference/installation.html
配置 SonataBlockBundle
https://sonata-project.org/bundles/block/master/doc/reference/installation.html
配置 SonataAdminBundle 与 SonataDoctrineORMAdminBundle
https://sonata-project.org/bundles/doctrine-orm-admin/2-2/doc/reference/installation.html
https://sonata-project.org/bundles/admin/master/doc/getting_started/installation.html
配置 SonataEasyExtendsBundle
https://sonata-project.org/bundles/easy-extends/master/doc/reference/installation.html
配置 SonataUserBundle 与 FOSUserBundle
https://symfony.com.cn/doc/current/bundles/FOSUserBundle/index.html
https://sonata-project.org/bundles/user/2-2/doc/reference/installation.html
// in AppKernel::registerBundles() $bundles = array( // ... new JMS\SerializerBundle\JMSSerializerBundle(), // ... );
配置 FOSRestServerBundle 与 JMSSerializerBundle
https://symfony.com.cn/doc/master/bundles/FOSRestBundle/1-setting_up_the_bundle.html
http://jmsyst.com/bundles/JMSSerializerBundle
配置 FOSOAuthServerBundle
https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/blob/master/Resources/doc/index.md
步骤 4. 配置 OpenppOAuthServerBundle
# app/config/config.yml openpp_oauth_server: client_class: Application\Openpp\OAuthServerBundle\Entity\Client access_token_class: Application\Openpp\OAuthServerBundle\Entity\AccessToken refresh_token_class: Application\Openpp\OAuthServerBundle\Entity\RefreshToken auth_code_class: Application\Openpp\OAuthServerBundle\Entity\AuthCode sonata_admin: dashboard: groups: application_openpp_oauth_server.admin.client: label: OAuth icon: '<i class="fa fa-cogs"></i>' items: - application_openpp_oauth_server.admin.client
# app/config/routing.yml fos_oauth_server_security: resource: "@OpenppOAuthServerBundle/Resources/config/routing/security.xml" prefix: / openpp_api_oauth_user: resource: "@OpenppOAuthServerBundle/Resources/config/routing/api/user.xml" prefix: /user type: rest openpp_api_oauth_verify: resource: "@OpenppOAuthServerBundle/Resources/config/routing/api/verify.xml" prefix: /verify type: rest
步骤 5. 扩展 OpenppOAuthServerBundle
$ php app/console sonata:easy-extends:generate OpenppOAuthServerBundle -d src
在内核中启用包:
// app/AppKernel.php class AppKernel { public function registerBundles() { $bundles = array( // ... new Application\Openpp\OAuthServerBundle\ApplicationOpenppOAuthServerBundle(), // ... ); }