Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kuma-guy/bear.jwtauthmodule
JSON Web Token Authentication for BEAR.Sunday
https://github.com/kuma-guy/bear.jwtauthmodule
bear jwt-authentication
Last synced: 26 days ago
JSON representation
JSON Web Token Authentication for BEAR.Sunday
- Host: GitHub
- URL: https://github.com/kuma-guy/bear.jwtauthmodule
- Owner: kuma-guy
- License: mit
- Created: 2016-05-27T12:32:52.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-18T03:53:22.000Z (over 6 years ago)
- Last Synced: 2024-11-18T09:46:54.205Z (about 2 months ago)
- Topics: bear, jwt-authentication
- Language: PHP
- Size: 30.3 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BEAR.JwtAuthModule
[![Build Status](https://travis-ci.org/kuma-guy/BEAR.JwtAuthModule.svg?branch=master)](https://travis-ci.org/kuma-guy/BEAR.JwtAuthModule) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/kuma-guy/BEAR.JwtAuthModule/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/kuma-guy/BEAR.JwtAuthModule/?branch=master)
JSON Web Token Authentication for BEAR.Sunday
## Installation
### Composer install
$ composer require kuma-guy/jwt-auth-module
### Module installThis package contains two modules for installing JSON Web Token Authentication.
#### Symmetric way
```php
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
```php
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;
```