2017 © Pedro Peláez
 

yii2-extension yii2-jwt

Trait for easier JWT integration

image

devmastersbv/yii2-jwt

Trait for easier JWT integration

  • Thursday, November 3, 2016
  • by DevMastersBV
  • Repository
  • 1 Watchers
  • 0 Stars
  • 196 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 18 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

yii2-jwt

JWT implementation for Yii2 Authorization process, (*1)

For details see JWT official website., (*2)

Installation

To install (only master is available now) run:, (*3)

    composer require "damirka/yii2-jwt:v0.2.1"

Or add this line to require section of composer.json:, (*4)

    "damirka/yii2-jwt": "v0.2.1"

Usage

There is only one trait - UserTrait - which gives you 5 methods for authorization and JWT-management in User model, (*5)

Set up:, (*6)

In controller:, (*7)

<?php

// ...

use yii\filters\auth\HttpBearerAuth;

class BearerAuthController extends \yii\rest\ActiveController
{
    public function behaviors()
    {
        return array_merge(parent::behaviors(), [
            'bearerAuth' => [
                'class' => HttpBearerAuth::className()
            ]
        ]);
    }
}

In User model:, (*8)

<?php

// ...

use yii\db\ActiveRecord;
use yii\web\IdentityInterface

class User extends ActiveRecord implements IdentityInterface
{
    // Use the trait in your User model
    use \damirka\JWT\UserTrait;

    // Override this method
    protected static function getSecretKey()
    {
        return 'someSecretKey';
    }

    // And this one if you wish
    protected static function getHeaderToken()
    {
        return [];
    }

    // ...
}

The Versions

03/11 2016

dev-master

9999999-dev https://github.com/damirka/yii2-jwt

Trait for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii

03/11 2016

0.2.4

0.2.4.0 https://github.com/damirka/yii2-jwt

Trait for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii

03/11 2016

0.2.2

0.2.2.0 https://github.com/damirka/yii2-jwt

Trait for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii

03/11 2016

0.2.3

0.2.3.0 https://github.com/damirka/yii2-jwt

Trait for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii

16/08 2016

v0.2.1

0.2.1.0 https://github.com/damirka/yii2-jwt

Trait for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii

10/08 2016

v0.2.0

0.2.0.0 https://github.com/damirka/yii2-jwt

Trait for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii

10/04 2016

v0.1.0

0.1.0.0 https://github.com/damirka/yii2-jwt

Trait for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii

09/11 2015

0.0.0

0.0.0.0 https://github.com/damirka/yii2-jwt

Set of classes for easier JWT integration

  Sources   Download

MIT

The Requires

 

jwt yii auth0