Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

kuma-guy/BEAR.JwtAuthModule

Open more actions menu

Repository files navigation

BEAR.JwtAuthModule

Build Status Scrutinizer Code Quality

JSON Web Token Authentication for BEAR.Sunday

Installation

Composer install

$ composer require kuma-guy/jwt-auth-module

Module install

This package contains two modules for installing JSON Web Token Authentication.

Symmetric way

use Ray\Di\AbstractModule;
use BEAR\JwtAuth\Auth\Auth;
use BEAR\JwtAuth\SymmetricJwtAuthModule;

class AppModule extends AbstractModule
{
    protected function configure()
    {
        $this->install(new SymmetricJwtAuthModule('symmetric algorithm', 'token time-to-live', 'secret'));
        $this->bind(Auth::class)->toProvider(AuthProvider::class)->in(Scope::SINGLETON);
    }
}

Asymmetric way

use Ray\Di\AbstractModule;
use BEAR\JwtAuth\Auth\Auth;
use BEAR\JwtAuth\AsymmetricJwtAuthModule;

class AppModule extends AbstractModule
{
    protected function configure()
    {
        $this->install(new AsymmetricJwtAuthModule('asymmetric algorithm', 'token time-to-live', 'private key', 'public key', 'pass phrase'));
        $this->bind(Auth::class)->toProvider(AuthProvider::class)->in(Scope::SINGLETON);
    }
}

Authentication

your user is injected by auth provider, you need to add this line in your resource class

use AuthInject;

About

JSON Web Token Authentication for BEAR.Sunday

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.