承接 antarccub/jwt-auth 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

antarccub/jwt-auth

Composer 安装命令:

composer require antarccub/jwt-auth

包简介

JWT Authentication for Laravel projects

README 文档

README

JWT-Auth for Laravel

JWT-Auth for Laravel

Installation

Package is available on Packagist,
you can install it using Composer.

composer require antarccub/jwt-auth  

After that, you need to publish config file with the following command:

php artisan vendor:publish --tag:jwt-config  

To start using the package you have to change your auth driver in the auth.php file:

'guards' => [  
 'web' => [ 'driver' => 'session', 'provider' => 'users', ],  
 'api' => [ 'driver' => 'jwt', // JWT Auth 'provider' => 'users', ], ],  

Basic Usage

Now you can use Laravel Auth facade with JWT Authentication

Route::middleware('auth:api')->get('/user', function (Request $request) {  
  
  return response()->json(Auth::user());  
}); 

Configuration

/*  
 * Here you can add all claims (iss, aud, jti, sub) you want to validate and theirs corresponding value * * Example: *  'iss' => 'http://example.com', * *  'jti' => '123123j2j3oj' * */  
 'claims' => [  
 // 'iss' => 'http://example.com',  
 ],  
 /* * Here you can config the signature verification type * */  
 'signature' => 'public-key', // public-key | secret  
  
 'methods' => [ 'public-key' => [ 'type' => 'RSA', // RSA, ECDSA 'signer' => 'SHA256', // RSA256, RSA348, RSA512 'provider' => 'Antarccub\JwtAuth\Providers\PublicKeyFileProvider',  
 'content' => storage_path('public.key'), // Only for PublicKeyFileProvider 'url' => env('JWT_PKEY') // Only for PublicKeyUrlProvider ],  
 'secret' => [ 'signer' => 'SHA256', 'value' => 'example' ] ]

Contributing

This package is for my personal use, but feel free to change all you want!

References

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固