All Projects → sergeymakinen → yii2-jwt-user

sergeymakinen / yii2-jwt-user

Licence: MIT License
JWT (JSON Web Token) User component for Yii 2

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to yii2-jwt-user

yii2-facades
Facades for Yii 2
Stars: ✭ 21 (+31.25%)
Mutual labels:  yii2, yii2-extension
yii2-firebird
Firebird connector for Yii2 framework
Stars: ✭ 23 (+43.75%)
Mutual labels:  yii2, yii2-extension
yii2-behaviors
Collection of useful behaviors for Yii Framework 2.0
Stars: ✭ 25 (+56.25%)
Mutual labels:  yii2, yii2-extension
yii2-payment
Yii2 Payment extension hổ trợ tích hợp các cổng thanh toán VnPayment, Onepay, Bảo Kim, Ngân Lượng, VTCPay, MoMo.
Stars: ✭ 20 (+25%)
Mutual labels:  yii2, yii2-extension
horse-jwt
Middleware for JWT in HORSE
Stars: ✭ 39 (+143.75%)
Mutual labels:  auth, token
yii2-timezone
Timezone detector
Stars: ✭ 14 (-12.5%)
Mutual labels:  yii2, yii2-extension
ar-dynattribute
Provide ActiveRecord dynamic attributes stored into the single field in serialized state
Stars: ✭ 43 (+168.75%)
Mutual labels:  yii2, yii2-extension
yii2-link-preview
LinkPreview widget render page preview
Stars: ✭ 26 (+62.5%)
Mutual labels:  yii2, yii2-extension
yii2-merit
Reputation engine for Yii2 用于实现积分,等级功能的设计
Stars: ✭ 16 (+0%)
Mutual labels:  yii2, yii2-extension
filedb
ActiveRecord for static data definitions based on files
Stars: ✭ 72 (+350%)
Mutual labels:  yii2, yii2-extension
ar-variation
Variation behavior for ActiveRecord
Stars: ✭ 46 (+187.5%)
Mutual labels:  yii2, yii2-extension
restify-jwt-community
Restify middleware that validates a JsonWebToken
Stars: ✭ 24 (+50%)
Mutual labels:  auth, token
yii2-presenter
Yii2 View Presenter
Stars: ✭ 13 (-18.75%)
Mutual labels:  yii2, yii2-extension
auth-flow-react-apollo-saga
Full stack login/register flow with React, Apollo, Redux, Redux-saga and MongoDB.
Stars: ✭ 22 (+37.5%)
Mutual labels:  auth, token
ar-role
ActiveRecord behavior, which provides relation roles (table inheritance)
Stars: ✭ 34 (+112.5%)
Mutual labels:  yii2, yii2-extension
yii2-ledap
yii2 for ledap
Stars: ✭ 20 (+25%)
Mutual labels:  yii2, yii2-extension
yii2-formbuilder
A drag and drop form builder with jQuery for Yii2
Stars: ✭ 33 (+106.25%)
Mutual labels:  yii2, yii2-extension
yii2-lock-form
disable the button when form submit
Stars: ✭ 37 (+131.25%)
Mutual labels:  yii2, yii2-extension
yii2-tinymce
Yii2 extension, tinymce wysiwyg editor
Stars: ✭ 16 (+0%)
Mutual labels:  yii2, yii2-extension
yii2-telegram
Support chat for site based on Telegram bot
Stars: ✭ 49 (+206.25%)
Mutual labels:  yii2, yii2-extension

JWT powered User for Yii 2

JWT (JSON Web Token) based Yii 2 User component drop-in replacement.

Code Quality Build Status Code Coverage SensioLabsInsight

Packagist Version Total Downloads Software License

Installation

The preferred way to install this extension is through composer.

Either run

composer require "sergeymakinen/yii2-jwt-user:^3.0"

or add

"sergeymakinen/yii2-jwt-user": "^3.0"

to the require section of your composer.json file.

Usage

Set the following Yii 2 configuration parameters:

[
    'components' => [
        'user' => [
            'class' => 'sergeymakinen\yii\jwtuser\User',
            'identityClass' => 'app\models\User',
            'enableAutoLogin' => true, // Optional
            'key' => 'random sign key (CHANGE IT!)',
        ],
    ],
]

Also set identityClass to whatever your identity class name is.

Don't forget: set key to some random value and make sure it's secret and long enough.

Configuration

You can choose between 3 different modes of sign key generation:

$useAuthKey value $appendAuthKey value Resulting key
false false sergeymakinen\yii\jwtuser\User::$key
true false yii\web\IdentityInterface::getAuthKey()
true true sergeymakinen\yii\jwtuser\User::$key
concatenated with
yii\web\IdentityInterface::getAuthKey()

Your choice depends on how you're going to use identities, revoke old/compromised keys.

It's also possible to specify "audience" and "issuer" claims (and validate against them) via corresponding $audience and $issuer properties. They both may be either strings or Closure returning a string.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].