定制 wfcreations/yii2-satellizer-server 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wfcreations/yii2-satellizer-server

Composer 安装命令:

composer require wfcreations/yii2-satellizer-server

包简介

Yii2 Satellizer server

README 文档

README

Satellizer is a simple to use, end-to-end, token-based authentication module for AngularJS with built-in support for Google, Facebook, LinkedIn, Twitter, Yahoo, Windows Live authentication providers, as well as Email and Password sign-in. You are not limited to the sign-in options above, in fact you can add any OAuth 1.0 or OAuth 2.0 provider by passing provider-specific information during the configuration step.

Latest Stable Version Total Downloads Latest Unstable Version License

Installation

The preferred way to install this extension is through composer.

Either run

composer require "wfcreations/yii2-satellizer-server:*"

or add

"wfcreations/yii2-satellizer-server": "*",

to the require section of your composer.json file.

Usage

To use this extension, simply add the following code in your application configuration:

'components' => [
  'satellizer' => [
    'class' => \wfcreations\satellizer\Satellizer::className(),
    'identityClass' => \common\models\ar\Advertiser::className(),
    'tokenLifetime' => 2 * 7 * 24 * 60 * 60,
    'jwtKey' => 'jwtsecret',
    'facebook' => [
      'clientSecret' => 'facebookscecret',
    ],
  ],
  // ...
]

In your auth controller

use yii\rest\Controller;

class AuthController extends Controller {

  public function actions() {
    return [
      'facebook' => [
        'class' => 'wfcreations\satellizer\actions\FacebookAction',
      ],
    ];
  }

  protected function verbs() {
    return [
      'facebook' => ['post', 'options'],
    ];
  }
  
  // ...

}
  

In others controllers that require authenticated user, just configure authenticator in behaviors:

'authenticator' => [
  'class' => HttpBearerAuth::className(),
],

If you want get authenticated user:

Yii::$app->user->identity

Provider supported

  • Facebook
  • Foursquare
  • Github
  • Google
  • LinkedIn
  • Via email and password
  • Twitter

For more information about yii2 api see Guide rest - Quick-start and yii2-app-api.

统计信息

  • 总下载量: 415
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2015-07-17