定制 developer-unijaya/rms-spid 二次开发

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

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

developer-unijaya/rms-spid

最新稳定版本:0.6.3

Composer 安装命令:

composer require developer-unijaya/rms-spid

包简介

eRMS-SPID Packages (API + SSO)

关键字:

README 文档

README

Latest Version on Packagist Total Downloads

Requirements

Installation

You can install the package via composer:

composer require developer-unijaya/rms-spid

Publish and run the migrations with:

php artisan vendor:publish --tag="rms-spid-migrations"
php artisan migrate

Publish the views file with:

php artisan vendor:publish --tag="RmsSpidView-views"

Publish the config file with:

php artisan vendor:publish --tag="rms-spid-config"

Add the following SPID_* variables in .env

SPID_BASE_URL=
SPID_USERNAME=
SPID_PASSWORD=
SPID_SUBSYSTEM=
SPID_KEY=
SPID_ENC_KEY=
SPID_LOG=true

The above SPID_* config value will be provided by SPID later.

Add following route to VerifyCsrfToken Exception in App\Http\Middleware\VerifyCsrfToken.php

class VerifyCsrfToken extends Middleware
{
    protected $except = [
        "spid/*"
    ];
}

Check and Locate your Auth Provider User Model config\auth.php

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\Models\User::class, // <= Your Auth Provider User Model
    ],
],

Add Laravel Sanctum HasApiTokens Trait to your Auth Provider User Model

use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens;
}

You can add HasUserSpid Trait to your Auth Provider User Model

use DeveloperUnijaya\RmsSpid\Traits\HasUserSpid;

class User extends Authenticatable
{
    use HasUserSpid;
}

Add VerifySpidKey Middleware in $routeMiddleware at App\Http\Kernel.php You can optionally Enable or Disable the middleware on the published Config File in spid_key property

protected $routeMiddleware = [
    // ...
    'verifyspidkey' => \DeveloperUnijaya\RmsSpid\Middleware\VerifySpidKey::class,
];

Usage

Register new User to SPID: Add following code to App\Http\Controllers\Auth\RegisterController.php

use Illuminate\Http\Request;
use DeveloperUnijaya\RmsSpid\Helpers\SpidHelper;

public function registered(Request $request, $user)
{
    SpidHelper::regUserSpid($user->id);
}

Update user Registration Status:

use DeveloperUnijaya\RmsSpid\Helpers\SpidHelper;

// Using SpidHelper
// Approve
SpidHelper::updateRegStatus($user_id, true);

// Reject
SpidHelper::updateRegStatus($user_id, false);

// Using Trait
// Approve
$user->approveSpidReg();

// Reject
$user->rejectSpidReg();

Delete user:

use DeveloperUnijaya\RmsSpid\Helpers\SpidHelper;

// Using SpidHelper
SpidHelper::deleteUserSpid($user_id);

Commands:

To clear all log datas:

php artisan spid:clear-log

To clear all expired redirect token:

php artisan spid:reset-expired-token

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-11