lubos/opauth

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

CakePHP Opauth 插件

安装: 305

依赖者: 2

建议者: 0

安全性: 0

星星: 5

观察者: 3

分支: 61

类型:cakephp-plugin

1.0.2 2014-03-21 10:46 UTC

This package is auto-updated.

Last update: 2024-09-04 19:33:25 UTC


README

原始源码 https://github.com/uzyn/cakephp-opauth

CakePHP 2.x 插件,用于Opauth

Opauth 是一个多认证提供者框架。

要求

CakePHP v2.x
Opauth >= v0.2 (包含此包的子模块)
可扩展

安装

  1. 使用 composer。将以下内容添加到 composer.json 文件中

    "require": {
    	"lubos/opauth": "~1.0"
    }
    

    然后运行 php composer.phar update

  2. 将 Opauth 库作为子模块下载。

    git submodule init
    git submodule update
  3. 将此行添加到您的应用 Config/bootstrap.php 文件的底部

    <?php
    CakePlugin::load('Opauth', array('routes' => true, 'bootstrap' => true));

    在上述行之后覆盖您想要的任何 Opauth 配置。

  4. 策略 加载到 Strategy/ 目录。

    按照以下方式在您的应用的 Config/bootstrap.php 文件中添加策略配置

    <?php
    CakePlugin::load('Opauth', array('routes' => true, 'bootstrap' => true));
    
    // Using Facebook strategy as an example
    Configure::write('Opauth.Strategy.Facebook', array(
        'app_id' => 'YOUR FACEBOOK APP ID',
        'app_secret' => 'YOUR FACEBOOK APP SECRET',
        'redirect' => '/'
    ));
  5. 访问 http://path_to_your_cake_app/auth/facebook 以使用 Facebook 进行身份验证,以及其他您已加载的策略。

  6. 验证后,您将被重定向到 Opauth.Strategy.Facebook.redirect url

注意

如果您的 CakePHP 应用 不在 DocumentRoot(例如,https://),而是在 DocumentRoot 下的目录中(例如,https:///your-cake-app),
请将此行添加到您的应用 APP/Config/bootstrap.php,将 your-cake-app 替换为您实际的路径

<?php // APP/Config/bootstrap.php
Configure::write('Opauth.path', '/your-cake-app/auth/');
Configure::write('Opauth.callback_url', '/your-cake-app/auth/callback');