承接 matrozov/yii2-wac-auth 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

matrozov/yii2-wac-auth

最新稳定版本:1.0.5

Composer 安装命令:

composer require matrozov/yii2-wac-auth

包简介

Yii2 CompositeAuth with AccessControl integration.

README 文档

README

Yii2 CompositeAuth with AccessControl integration.

By default, AuthMethod checks only the internal "optional" property to test whether it is possible to get into this action without authorization. You should duplicate the access rules in AuthMethod and AccessControl. WacAuth allows you to automatically check the guest access rules in AccessControl when AuthMethod is authorized.

Installation

Either run

composer require --prefer-dist matrozov/yii2-wac-auth

Usage example

Before:

$behaviors['authenticator'] = [
    'class' => HttpBearerAuth::className(),
    'optional' => ['index']
];

$behaviors['access'] = [
    'class' => AccessControl::className(),
    'only' => ['index'],
    'rules' => [
        [
            'allow' => true,
            'actions' => ['index'],
            'roles' => ['?'],
        ],
    ],
];

You specify the "optional" property and roles="?" at the same time for your action "index".

After:

$behaviors['authenticator'] = [
    'class' => WacAuth::className(),
    'authMethods' => [
        HttpBearerAuth::className()
    ]
];

$behaviors['access'] = [
    'class' => AccessControl::className(),
    'only' => ['index'],
    'rules' => [
        [
            'allow' => true,
            'actions' => ['index'],
            'roles' => ['?'],
        ],
    ],
];

You wrap HttpBearerAuth in WacAuth and now it automatically takes into account roles="?" in AccessControl.

WacAuth and CompositeAuth

Since WacAuth is the successor of CompositeAuth, you can use it in all similar cases for a combination of authorization methods.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固