aciliainternet/oauth-authorization-bundle

此包最新版本(2.0.8)没有提供许可信息。

Acilia 授权包

2.0.8 2021-02-02 11:54 UTC

README

Acilia oAuth 认证和授权包,适用于 Symfony2/3

OauthAuthorizationBundle

由 Acilia Internet 开发的适用于 Symfony2 和 Symfony3 的 Oauth 授权包

此包允许通过 Oauth2 API 服务进行认证和获取授权,并创建一个 UserProviderInterface

安装和配置

使用 Composer 非常简单,运行

composer require aciliainternet/oauth-authorization-bundle

将 OauthAuthorizationBundle 添加到您的应用程序内核

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Acilia\Bundle\OauthAuthorizationBundle\AciliaOauthAuthorizationBundle(),
        // ...
    );
}

配置示例

此包提供了一个基本的 security.yml,您可以从您的 security.yml 文件中导入

imports:
    - { resource: "@AciliaOauthAuthorizationBundle/Resources/config/security.yml" }

您必须配置一些参数

acilia_oauth_authorization:
    access_url: 'http://api.my-oauth2.com' # url of the oauth api
    enabled: true                          # enable or disable authentication, if false users as authenticated as 'anon.'
    oauth_secret: '_secret_hash_'          # hash for encrypt requests to the api
    client_id: 'my_app_identifier_key'     # unique identifier for the application
    excludes: ['www.domain-excluded.com']  # array of domains to exclude from the auth checking

最后,您需要定义登出路径。将以下内容添加到您的 routing.yml 文件中

logout:
    path: /logout