定制 laradevs/authremote 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

laradevs/authremote

Composer 安装命令:

composer require laradevs/authremote

包简介

It is a component that allows to carry out and manage the authentication control through OAUTH2.0 for a Laravel application.

README 文档

README

AUTH REMOTE

It is a component that allows to carry out and manage the authentication control through OAUTH2.0 for a Laravel application.

Installation

You can install the package via composer :

$ composer require laradevs/authremote

Next, You must register the service provider (optional) :

// config/app.php

'Providers' => [
   // ...
    \LaraDevs\AuthRemote\MainServiceProvider::class,
]

Next, you must publish the configuration file to define the OAUTH server credentials:

php artisan vendor:publish --provider="LaraDevs\AuthRemote\MainServiceProvider"

This is the contents of the published file :

return [
    'uri' => env('USER_PROVIDER_REST_URL', ''),
    'name_session_rest' => 'token_oauth',
    'headers' => [],
    'route_not_session'=>'start_route'
];

Set your URL Rest in .env file :

APP_NAME="Laravel"
# ...
USER_PROVIDER_REST_URL=putYourRestURL

Add in Array Services

'laravelpassport' => [
        'client_id' => env('LARAVELPASSPORT_KEY','http://YOUR_ROUTE_HOST_SERVER/api/user'),
        'client_secret' => env('LARAVELPASSPORT_SECRET'),
        'redirect' => env('LARAVELPASSPORT_REDIRECT_URI'),
        'host'=> env('LARAVELPASSPORT_HOST')
    ]

Add in Handle Exception in method render

 if ($exception instanceof \LaraDevs\AuthRemote\RestException) {
            return redirect()->route(config('rest-provider.route_not_session'));
 }

Add in Array Auth

  'providers' => [
        'users' => [
            'driver' => 'rest-users',
            'model' => \LaraDevs\AuthRemote\User::class
        ],
  ]

Route Login & Logout published automatic

Route::get('/auth-remote/{provider}', '\LaraDevs\AuthRemote\ActionsController@redirectToProvider')->name('laravel_passport');
Route::get('/auth-remote/{provider}/callback', '\LaraDevs\AuthRemote\ActionsController@handleProviderCallback');
Route::post('/auth-remote-logout','\LaraDevs\AuthRemote\ActionsController@logout')->name('laravel_passport.logout');

Add route name for initial route

Route::get('/', function () {
    return view('welcome');
})->name(config('rest-provider.route_not_session'));

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固