Download the PHP package sweelix/yii2-oauth2-server without Composer

On this page you can find all versions of the php package sweelix/yii2-oauth2-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-oauth2-server

Oauth2 Yii2 integration

This extension allow the developper to use Oauth2 server.

Latest Stable Version Build Status Scrutinizer Code Quality Code Coverage License

Latest Development Version Build Status Scrutinizer Code Quality Code Coverage composer.lock

Installation

If you use Packagist for installing packages, then you can update your composer.json like this :

How to use it

Add extension to your configuration :

You also need to enable PrettyUrl:

Migrations (MySql only)

All the migrations needed can be found inside src/migrations. Be sure to configure the database connection before applying them.

Grant types

You can find examples and explanations about every grant types here and here.

For the Jwt Bearer Grant, you will need to create a Jwt entry in your database for the given client and subject.

Configure Module

Basic module parameters

Grants management

JWT parameters (:warning: Not sure about the implementation. Use at your own risk !)

Time To Live

Basic Oauth names

Enforce parameters

OpenID

Authorization Code parameters

CORS

User identity and Web user

Configure the user component to link oauth2 system and user / identity management

IdentityClass must implements sweelix\oauth2\server\interfaces\UserModelInterface. You can use the trait sweelix\oauth2\server\traits\IdentityTrait to automagically implement

you will have to implement the remaining methods :

Creating specific view for OAuth2

In order to use your own views (instead of the builtin ones), you can override

Overriding layout

You should create a classic layout like :

and link it to the module

Overriding views

You should create 3 views to allow oauth2 module to work as expected and link them to the module

Error view

This view is used to display a page when an error occurs

Login view

This view is used to display a login page when needed

Authorize view

This view is used to display an authorization page when needed

Exposed Models overview

The Oauth2 Yii2 extension expose severall models which can be used in your application. All models can be overloaded using Yii2 DI.

For example, if you want to overload the Client model, you have to inject your own model in the DI using:

Client / ClientModelInterface

AccessToken / AccessTokenModelInterface

RefreshToken / RefreshTokenModelInterface

AuthCode / AuthCodeModelInterface

Scope / ScopeModelInterface

CypherKey / CypherKeyModelInterface

Jti / JtiModelInterface (:warning: Not sure about the implementation. Use at your own risk !)

Jwt / JwtModelInterface (:warning: Not sure about the implementation. Use at your own risk !)

Linking RBAC and Scope systems

Using sweelix\oauth2\server\web\User class will automagically link rbac system and oauth2 system.

Permission system will be slightly modified to allow fine grained checks :

Running the tests

Before running the tests, you should edit the file tests/config/BACKEND.php and change the config to match your environment.

CLI System

Several commands are available to manage oauth2 system


All versions of yii2-oauth2-server with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
ext-openssl Version *
yiisoft/yii2 Version ~2.0.13
yiisoft/yii2-redis Version ~2.0
bshaffer/oauth2-server-php Version ~1.8
yiisoft/yii2-bootstrap Version ~2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sweelix/yii2-oauth2-server contains the following files

Loading the files please wait ....