承接 diadal/passport 相关项目开发

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

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

diadal/passport

Composer 安装命令:

composer require diadal/passport

包简介

Convert client_id to Uuid in Laravel Passport

README 文档

README

Build Status Total Downloads License

Introduction

Laravel Passport is an OAuth2 server and API authentication package that is simple and enjoyable to use. This Package will enable you you convert client id and client_id to Uuid which is more secure and safe for production

Installation

composer require diadal/passport

Laravel 5.5 hight auto discover package you may need to register in your config app.php under providers

Diadal\Passport\PassportServiceProvider::class,

Next in app/Providers/AppServiceProvider.php add \Laravel\Passport\Passport::ignoreMigrations(); to register

public function register()
    {
        //....
        \Laravel\Passport\Passport::ignoreMigrations();
    }

Next

php artisan config:clear

To publish Cilent Uuid migration use this

php artisan vendor:publish --tag=passport-cilent-migrations

if no file published try

php artisan config:clear

and retry php artisan vendor:publish --tag=passport-cilent-migrations

Note you can use this both

Migrate your Database

php artisan migrate

Next In AuthServiceProvider @ app/Providers/AuthServiceProvider.php add use Diadal\Passport\Passport;

<?php

namespace App\Providers;

use Diadal\Passport\Passport;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        'App\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        Passport::routes();
        \Laravel\Passport\Passport::useClientModel(\Diadal\Passport\Client::class);
        \Laravel\Passport\Passport::usePersonalAccessClientModel(\Diadal\Passport\PersonalAccessClient::class);

        Passport::tokensCan([
            'all' => 'All Function',
            'create-invoice' => 'Create Invoice',
        ]);

        Passport::tokensExpireIn(now()->addDays(15));

        Passport::refreshTokensExpireIn(now()->addDays(30));
    }
}

Next, you should run the passport:install command

php artisan passport:install
php artisan config:clear

All default Laravel Passport remain the same

Official Documentation

Documentation for Passport can be found on the Laravel website.

Any issue check here

also you can buy me a coffee @ Patreon

统计信息

  • 总下载量: 4.72k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-28